{"id":24945,"date":"2026-10-15T00:58:05","date_gmt":"2026-10-15T00:58:05","guid":{"rendered":"https:\/\/www.mechstream.com\/?p=24945"},"modified":"2026-10-15T00:58:08","modified_gmt":"2026-10-15T00:58:08","slug":"vickers-hardness-hv-calculator","status":"publish","type":"post","link":"https:\/\/www.mechstream.com\/ar\/vickers-hardness-hv-calculator\/","title":{"rendered":"Vickers Hardness (HV) Calculator"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The Vickers Hardness (HV) Calculator is a reliable online tool designed to calculate the Vickers hardness of metals and engineering materials quickly and accurately. By entering the applied test force and the two indentation diagonal measurements, users can instantly determine the Vickers hardness value (HV). This calculator is ideal for mechanical engineers, materials scientists, quality control inspectors, and heat treatment professionals. Whether you are testing steel, stainless steel, aluminum alloys, or other metallic materials, the Vickers Hardness (HV) Calculator simplifies hardness calculations, supports material evaluation, and improves efficiency in manufacturing, metal processing, heat treatment, and quality control applications.<\/p>\n\n\n\n<!-- Vickers Hardness (HV) Calculator - WordPress Custom HTML block snippet. All CSS is scoped to .vhc-root. Vanilla JS, no external libraries. -->\n<div id=\"vhc-calculator\" class=\"vhc-root\" data-vhc-widget=\"vickers-hardness\">\n<style>\n.vhc-root,.vhc-root *,.vhc-root *::before,.vhc-root *::after{box-sizing:border-box}\n.vhc-root{\n  --vhc-bg:#f5f5f7;--vhc-card:#ffffff;--vhc-text:#1d1d1f;--vhc-muted:#5f5f66;--vhc-soft:#76767c;\n  --vhc-line:#d2d2d7;--vhc-line-soft:#e8e8ed;--vhc-accent:#0071e3;--vhc-accent-dark:#0058b0;--vhc-accent-soft:#e8f2fd;\n  --vhc-ok:#0a7c42;--vhc-ok-soft:#e6f4ec;--vhc-warn:#8a5a00;--vhc-warn-soft:#fff6e0;--vhc-err:#c4291c;--vhc-err-soft:#fdecea;\n  width:100%;max-width:1040px;margin:24px auto;padding:32px;background:var(--vhc-bg);color:var(--vhc-text);\n  border-radius:22px;font-family:-apple-system,BlinkMacSystemFont,\"SF Pro Text\",\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,sans-serif;\n  font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased;text-align:left\n}\n.vhc-root p,.vhc-root ul,.vhc-root ol,.vhc-root li,.vhc-root h2,.vhc-root h3,.vhc-root table,.vhc-root figure,.vhc-root dl,.vhc-root dd,.vhc-root dt,.vhc-root details,.vhc-root summary,.vhc-root fieldset{margin:0;padding:0;border:0;background:none;text-transform:none;letter-spacing:normal;font-family:inherit;color:inherit}\n.vhc-root [hidden],.vhc-root .vhc-hide{display:none!important}\n.vhc-root .vhc-card{background:var(--vhc-card);border:1px solid var(--vhc-line-soft);border-radius:18px;padding:24px;box-shadow:0 1px 2px rgba(0,0,0,.04);min-width:0}\n.vhc-root .vhc-card+.vhc-card{margin-top:16px}\n.vhc-root .vhc-card-title{margin:0 0 4px;color:var(--vhc-text);font-size:1.1rem;font-weight:600;line-height:1.2;display:flex;align-items:center;gap:10px}\n.vhc-root .vhc-step{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex:0 0 24px;border-radius:50%;background:var(--vhc-accent-soft);color:var(--vhc-accent);font-size:.8rem;font-weight:700}\n.vhc-root .vhc-card-note{color:var(--vhc-muted);font-size:.9rem;margin-bottom:18px}\n.vhc-root .vhc-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 20px}\n.vhc-root .vhc-field{min-width:0;position:relative}\n.vhc-root .vhc-span{grid-column:1\/-1}\n.vhc-root .vhc-label{display:flex;align-items:center;gap:6px;font-size:.9rem;font-weight:600;color:var(--vhc-text);margin:0 0 6px}\n.vhc-root .vhc-label label{margin:0;font:inherit;color:inherit}\n.vhc-root .vhc-opt{font-weight:400;color:var(--vhc-soft)}\n.vhc-root .vhc-hint{display:block;color:var(--vhc-soft);font-size:.8rem;margin-top:5px}\n.vhc-root .vhc-hint:empty{display:none}\n.vhc-root .vhc-error{display:block;color:var(--vhc-err);font-size:.82rem;margin-top:4px}\n.vhc-root .vhc-error:empty{display:none}\n.vhc-root .vhc-row{display:grid;grid-template-columns:minmax(0,1fr) 92px;gap:8px}\n.vhc-root input[type=number],.vhc-root select{\n  -webkit-appearance:none;appearance:none;width:100%;min-height:46px;margin:0;padding:10px 14px;font:inherit;font-size:16px;line-height:1.3;\n  color:var(--vhc-text);background-color:#fff;border:1px solid var(--vhc-line);border-radius:12px;box-shadow:none;outline:none;\n  transition:border-color .15s ease,box-shadow .15s ease;max-width:none;height:auto\n}\n.vhc-root select{padding-right:34px;background-image:linear-gradient(45deg,transparent 50%,#6e6e73 50%),linear-gradient(135deg,#6e6e73 50%,transparent 50%);background-position:calc(100% - 18px) 20px,calc(100% - 13px) 20px;background-size:5px 5px,5px 5px;background-repeat:no-repeat;cursor:pointer}\n.vhc-root input[type=number]:focus,.vhc-root select:focus{border-color:var(--vhc-accent);box-shadow:0 0 0 4px rgba(0,113,227,.18)}\n.vhc-root .vhc-invalid{border-color:var(--vhc-err)!important;box-shadow:0 0 0 3px rgba(196,41,28,.12)!important}\n.vhc-root .vhc-seg{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));min-width:0;width:100%;gap:4px;padding:4px;background:#ececf0;border-radius:13px;border:0;margin:0 0 18px;position:relative}\n.vhc-root .vhc-seg legend{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);padding:0}\n.vhc-root .vhc-seg input{position:absolute;opacity:0;width:1px;height:1px;margin:0}\n.vhc-root .vhc-seg label{display:flex;align-items:center;justify-content:center;min-height:40px;padding:6px 8px;border-radius:10px;font-size:.93rem;font-weight:600;color:var(--vhc-muted);cursor:pointer;text-align:center;transition:background .15s,color .15s,box-shadow .15s;margin:0}\n.vhc-root .vhc-seg input:checked+label{background:#fff;color:var(--vhc-text);box-shadow:0 1px 3px rgba(0,0,0,.12)}\n.vhc-root .vhc-seg input:focus-visible+label{outline:3px solid rgba(0,113,227,.35);outline-offset:1px}\n.vhc-root .vhc-avg{grid-column:1\/-1;padding:10px 14px;border-radius:12px;background:#f9f9fb;border:1px solid var(--vhc-line-soft);font-size:.9rem;color:var(--vhc-muted)}\n.vhc-root .vhc-avg strong{color:var(--vhc-text);font-variant-numeric:tabular-nums}\n.vhc-root .vhc-tipwrap{position:static;display:inline-flex}\n.vhc-root .vhc-tip{-webkit-appearance:none;appearance:none;width:18px;height:18px;min-height:0;min-width:0;padding:0;margin:0;border-radius:50%;border:1px solid var(--vhc-line);background:#fff;color:var(--vhc-muted);font:600 11px\/1 inherit;font-family:inherit;cursor:help;display:inline-flex;align-items:center;justify-content:center;box-shadow:none;text-transform:none}\n.vhc-root .vhc-tip:focus-visible{outline:3px solid rgba(0,113,227,.35);outline-offset:1px}\n.vhc-root .vhc-tip-text{position:absolute;left:0;right:0;bottom:calc(100% - 2px);padding:8px 10px;border-radius:10px;background:#1d1d1f;color:#fff;font-size:.78rem;font-weight:400;line-height:1.4;visibility:hidden;opacity:0;transition:opacity .15s;z-index:20;pointer-events:none;text-align:left}\n.vhc-root .vhc-tipwrap:hover .vhc-tip-text,.vhc-root .vhc-tip:focus+.vhc-tip-text{visibility:visible;opacity:1}\n.vhc-root .vhc-diagram{margin-top:18px;border:1px solid var(--vhc-line-soft);border-radius:14px;background:#fbfbfd;padding:12px}\n.vhc-root .vhc-diagram svg{display:block;width:100%;height:auto;max-height:260px}\n.vhc-root .vhc-diagram figcaption{font-size:.8rem;color:var(--vhc-muted);margin-top:6px;text-align:center}\n.vhc-root .vhc-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:22px}\n.vhc-root .vhc-btn{-webkit-appearance:none;appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:46px;min-width:150px;margin:0;padding:10px 22px;border-radius:999px;border:1px solid transparent;font:inherit;font-size:.98rem;font-weight:600;line-height:1.2;cursor:pointer;text-decoration:none;text-transform:none;letter-spacing:normal;box-shadow:none;transition:background .15s,border-color .15s,color .15s;float:none;width:auto}\n.vhc-root .vhc-btn-primary{background:var(--vhc-accent);color:#fff;min-width:220px;font-size:1.05rem;min-height:52px}\n.vhc-root .vhc-btn-primary:hover,.vhc-root .vhc-btn-primary:focus{background:var(--vhc-accent-dark);color:#fff}\n.vhc-root .vhc-btn-ghost{background:#fff;color:var(--vhc-accent-dark);border-color:var(--vhc-line)}\n.vhc-root .vhc-btn-ghost:hover,.vhc-root .vhc-btn-ghost:focus{border-color:var(--vhc-accent);background:#fff;color:var(--vhc-accent-dark)}\n.vhc-root .vhc-btn-small{min-height:38px;min-width:0;padding:7px 16px;font-size:.88rem}\n.vhc-root .vhc-btn:focus-visible{outline:3px solid rgba(0,113,227,.35);outline-offset:2px}\n.vhc-root .vhc-form-msg{text-align:center;color:var(--vhc-err);font-size:.88rem;margin-top:10px}\n.vhc-root .vhc-form-msg:empty{display:none}\n.vhc-root .vhc-results-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;margin-bottom:16px}\n.vhc-root .vhc-tools{display:flex;flex-wrap:wrap;gap:8px}\n.vhc-root .vhc-main{background:var(--vhc-accent-soft);border:1px solid #cfe3fa;border-radius:16px;padding:18px 20px}\n.vhc-root .vhc-main-label{font-size:.78rem;font-weight:600;color:var(--vhc-accent-dark);text-transform:uppercase;letter-spacing:.05em;display:flex;flex-wrap:wrap;gap:8px;align-items:center}\n.vhc-root .vhc-main-value{font-size:clamp(2.3rem,6vw,3.3rem);font-weight:700;letter-spacing:-.03em;line-height:1.05;margin-top:6px;font-variant-numeric:tabular-nums;color:var(--vhc-text);overflow-wrap:anywhere}\n.vhc-root .vhc-main-value span{font-size:.45em;font-weight:600;color:var(--vhc-muted);letter-spacing:0;margin-left:6px}\n.vhc-root .vhc-main-sub{font-size:.88rem;color:var(--vhc-muted);margin-top:8px}\n.vhc-root .vhc-desig{display:inline-block;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-weight:700;color:var(--vhc-text);background:#fff;border:1px solid #cfe3fa;border-radius:8px;padding:1px 8px}\n.vhc-root .vhc-badge{display:inline-block;padding:2px 9px;border-radius:999px;font-size:.72rem;font-weight:700;letter-spacing:.03em;text-transform:uppercase}\n.vhc-root .vhc-badge-ok{background:var(--vhc-ok-soft);color:var(--vhc-ok)}\n.vhc-root .vhc-badge-warn{background:#fdebb8;color:var(--vhc-warn)}\n.vhc-root .vhc-badge-info{background:#fff;color:var(--vhc-accent-dark);border:1px solid #cfe3fa}\n.vhc-root .vhc-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:12px}\n.vhc-root .vhc-kpi{background:#f9f9fb;border:1px solid var(--vhc-line-soft);border-radius:14px;padding:11px 13px;min-width:0}\n.vhc-root .vhc-kpi-label{font-size:.72rem;font-weight:600;color:var(--vhc-muted);text-transform:uppercase;letter-spacing:.04em}\n.vhc-root .vhc-kpi-value{font-size:1.05rem;font-weight:700;margin-top:2px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}\n.vhc-root .vhc-kpi-sub{font-size:.78rem;color:var(--vhc-muted);margin-top:1px;overflow-wrap:anywhere}\n.vhc-root .vhc-formula{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.92em;color:var(--vhc-text)}\n.vhc-root .vhc-box{margin-top:14px;border:1px solid var(--vhc-line-soft);border-radius:14px;padding:14px 16px;background:#fff}\n.vhc-root .vhc-box-title{font-size:.9rem;font-weight:700;margin:0 0 8px;color:var(--vhc-text)}\n.vhc-root .vhc-steps{list-style:decimal;padding-left:22px;font-size:.9rem;color:var(--vhc-text)}\n.vhc-root .vhc-steps li{margin:0 0 8px;padding:0}\n.vhc-root .vhc-steps li span{display:block;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.86rem;color:var(--vhc-muted);overflow-wrap:anywhere}\n.vhc-root .vhc-alerts{margin-top:14px;display:grid;gap:8px}\n.vhc-root .vhc-alert{border-radius:12px;padding:10px 14px;font-size:.88rem;line-height:1.45}\n.vhc-root .vhc-alert-warn{background:var(--vhc-warn-soft);color:#5c3d00;border:1px solid #f1dca6}\n.vhc-root .vhc-alert-info{background:#f9f9fb;color:var(--vhc-muted);border:1px solid var(--vhc-line-soft)}\n.vhc-root .vhc-tablewrap{overflow-x:auto;-webkit-overflow-scrolling:touch}\n.vhc-root table.vhc-table{width:100%;border-collapse:collapse;font-size:.88rem;min-width:380px}\n.vhc-root table.vhc-table th,.vhc-root table.vhc-table td{padding:8px 10px;border:0;border-bottom:1px solid var(--vhc-line-soft);text-align:left;vertical-align:top;background:none;color:var(--vhc-text)}\n.vhc-root table.vhc-table th{font-size:.74rem;text-transform:uppercase;letter-spacing:.04em;color:var(--vhc-muted);font-weight:700}\n.vhc-root table.vhc-table td.vhc-num{font-variant-numeric:tabular-nums;font-weight:700;white-space:nowrap}\n.vhc-root .vhc-small{font-size:.8rem;color:var(--vhc-soft);margin-top:8px}\n.vhc-root .vhc-toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(20px);background:#1d1d1f;color:#fff;padding:10px 18px;border-radius:999px;font-size:.9rem;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:99999;max-width:calc(100% - 32px);text-align:center}\n.vhc-root .vhc-toast.vhc-show{opacity:1;transform:translateX(-50%) translateY(0)}\n.vhc-root .vhc-sr{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important}\n@media (max-width:860px){.vhc-root .vhc-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}\n@media (max-width:700px){\n  .vhc-root{padding:18px 16px;border-radius:16px;margin:12px auto}\n  .vhc-root .vhc-card{padding:18px 16px;border-radius:16px}\n  .vhc-root .vhc-grid{grid-template-columns:1fr}\n  .vhc-root .vhc-actions .vhc-btn{flex:1 1 100%}\n  .vhc-root .vhc-results-head{flex-direction:column;align-items:flex-start}\n}\n@media (max-width:380px){.vhc-root .vhc-row{grid-template-columns:minmax(0,1fr) 80px}}\n@media (max-width:330px){.vhc-root .vhc-kpis{grid-template-columns:1fr}}\n@media (prefers-reduced-motion:reduce){.vhc-root *{transition:none!important}}\n<\/style>\n<form class=\"vhc-form\" novalidate onsubmit=\"return false;\">\n<section class=\"vhc-card\" aria-labelledby=\"vhc-h-force\">\n<div class=\"vhc-card-title\" id=\"vhc-h-force\"><span class=\"vhc-step\" aria-hidden=\"true\">1<\/span>Test Force<\/div>\n<p class=\"vhc-card-note\">Enter the applied test force and choose its unit.<\/p>\n<div class=\"vhc-grid\">\n<div class=\"vhc-field\">\n<div class=\"vhc-label\"><label for=\"vhc-force\">Applied test force (F)<\/label><span class=\"vhc-tipwrap\"><button type=\"button\" class=\"vhc-tip\" aria-label=\"About the test force\" aria-describedby=\"vhc-tip-force\">?<\/button><span class=\"vhc-tip-text\" role=\"tooltip\" id=\"vhc-tip-force\">The nominal force applied by the Vickers tester, e.g. 30 kgf for HV 30 or 500 gf for HV 0.5. 1 kgf = 9.80665 N.<\/span><\/span><\/div>\n<div class=\"vhc-row\">\n<input id=\"vhc-force\" name=\"force\" type=\"number\" inputmode=\"decimal\" step=\"any\" min=\"0\" value=\"30\" aria-describedby=\"vhc-force-hint vhc-force-err\" required>\n<select id=\"vhc-force-unit\" name=\"forceUnit\" aria-label=\"Force unit\"><option value=\"N\">N<\/option><option value=\"kgf\" selected>kgf<\/option><option value=\"gf\">gf<\/option><option value=\"mN\">mN<\/option><\/select>\n<\/div>\n<span class=\"vhc-hint\" id=\"vhc-force-hint\">Changing the unit converts the value.<\/span>\n<span class=\"vhc-error\" id=\"vhc-force-err\" role=\"alert\"><\/span>\n<\/div>\n<div class=\"vhc-field\">\n<div class=\"vhc-label\"><label for=\"vhc-dwell\">Dwell time (s) <span class=\"vhc-opt\">&#8212; optional<\/span><\/label><span class=\"vhc-tipwrap\"><button type=\"button\" class=\"vhc-tip\" aria-label=\"About dwell time\" aria-describedby=\"vhc-tip-dwell\">?<\/button><span class=\"vhc-tip-text\" role=\"tooltip\" id=\"vhc-tip-dwell\">Time the full test force is held. The standard duration is 10 to 15 s. Only used for the test designation, e.g. HV 30\/20 for a 20 s dwell.<\/span><\/span><\/div>\n<input id=\"vhc-dwell\" name=\"dwell\" type=\"number\" inputmode=\"decimal\" step=\"any\" min=\"0\" placeholder=\"10&#8211;15 s standard\" aria-describedby=\"vhc-dwell-err\">\n<span class=\"vhc-error\" id=\"vhc-dwell-err\" role=\"alert\"><\/span>\n<\/div>\n<div class=\"vhc-field\">\n<label class=\"vhc-label\" for=\"vhc-prec\">Result precision<\/label>\n<select id=\"vhc-prec\" name=\"precision\"><option value=\"0\">0 decimal places<\/option><option value=\"1\">1 decimal place<\/option><option value=\"2\" selected>2 decimal places<\/option><option value=\"3\">3 decimal places<\/option><\/select>\n<\/div>\n<div class=\"vhc-field\">\n<div class=\"vhc-label\"><label for=\"vhc-thr\">Diagonal difference warning (%)<\/label><span class=\"vhc-tipwrap\"><button type=\"button\" class=\"vhc-tip\" aria-label=\"About the diagonal warning\" aria-describedby=\"vhc-tip-thr\">?<\/button><span class=\"vhc-tip-text\" role=\"tooltip\" id=\"vhc-tip-thr\">A screening aid: warns when |d&#8321; &#8722; d&#8322;| exceeds this percentage of the average diagonal. It is not a universal acceptance criterion &#8212; follow your testing standard.<\/span><\/span><\/div>\n<input id=\"vhc-thr\" name=\"threshold\" type=\"number\" inputmode=\"decimal\" step=\"any\" min=\"0\" value=\"5\" aria-describedby=\"vhc-thr-err\">\n<span class=\"vhc-error\" id=\"vhc-thr-err\" role=\"alert\"><\/span>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"vhc-card\" aria-labelledby=\"vhc-h-ind\">\n<div class=\"vhc-card-title\" id=\"vhc-h-ind\"><span class=\"vhc-step\" aria-hidden=\"true\">2<\/span>Indentation Diagonals<\/div>\n<p class=\"vhc-card-note\">Measure both diagonals of the indentation at right angles, or enter the average diagonal directly.<\/p>\n<fieldset class=\"vhc-seg\">\n<legend>Measurement mode<\/legend>\n<input type=\"radio\" id=\"vhc-m-two\" name=\"vhc-mode\" value=\"two\" checked><label for=\"vhc-m-two\">Two-Diagonal Measurement<\/label>\n<input type=\"radio\" id=\"vhc-m-avg\" name=\"vhc-mode\" value=\"avg\"><label for=\"vhc-m-avg\">Average Diagonal Input<\/label>\n<\/fieldset>\n<div class=\"vhc-grid\">\n<div class=\"vhc-field\" id=\"vhc-d1-wrap\">\n<div class=\"vhc-label\"><label for=\"vhc-d1\">First diagonal (d&#8321;)<\/label><span class=\"vhc-tipwrap\"><button type=\"button\" class=\"vhc-tip\" aria-label=\"About d1\" aria-describedby=\"vhc-tip-d1\">?<\/button><span class=\"vhc-tip-text\" role=\"tooltip\" id=\"vhc-tip-d1\">Corner-to-corner length of the indentation measured in one direction with the tester&#8217;s optical system.<\/span><\/span><\/div>\n<div class=\"vhc-row\">\n<input id=\"vhc-d1\" name=\"d1\" type=\"number\" inputmode=\"decimal\" step=\"any\" min=\"0\" value=\"0.50\" aria-describedby=\"vhc-d1-err\">\n<select id=\"vhc-d1-unit\" name=\"d1Unit\" aria-label=\"Unit of first diagonal\"><option value=\"mm\" selected>mm<\/option><option value=\"um\">&micro;m<\/option><\/select>\n<\/div>\n<span class=\"vhc-error\" id=\"vhc-d1-err\" role=\"alert\"><\/span>\n<\/div>\n<div class=\"vhc-field\" id=\"vhc-d2-wrap\">\n<div class=\"vhc-label\"><label for=\"vhc-d2\">Second diagonal (d&#8322;)<\/label><span class=\"vhc-tipwrap\"><button type=\"button\" class=\"vhc-tip\" aria-label=\"About d2\" aria-describedby=\"vhc-tip-d2\">?<\/button><span class=\"vhc-tip-text\" role=\"tooltip\" id=\"vhc-tip-d2\">The diagonal measured at 90&#176; to d&#8321;. Comparing both helps reveal tilt, anisotropy or measuring errors.<\/span><\/span><\/div>\n<div class=\"vhc-row\">\n<input id=\"vhc-d2\" name=\"d2\" type=\"number\" inputmode=\"decimal\" step=\"any\" min=\"0\" value=\"0.52\" aria-describedby=\"vhc-d2-err\">\n<select id=\"vhc-d2-unit\" name=\"d2Unit\" aria-label=\"Unit of second diagonal\"><option value=\"mm\" selected>mm<\/option><option value=\"um\">&micro;m<\/option><\/select>\n<\/div>\n<span class=\"vhc-error\" id=\"vhc-d2-err\" role=\"alert\"><\/span>\n<\/div>\n<div class=\"vhc-avg\" id=\"vhc-avg\" aria-live=\"polite\">Average diagonal d = (d&#8321; + d&#8322;) \/ 2 = <strong id=\"vhc-avg-val\">&#8212;<\/strong><\/div>\n<div class=\"vhc-field vhc-span vhc-hide\" id=\"vhc-d-wrap\" hidden>\n<div class=\"vhc-label\"><label for=\"vhc-d\">Average indentation diagonal (d)<\/label><span class=\"vhc-tipwrap\"><button type=\"button\" class=\"vhc-tip\" aria-label=\"About the average diagonal\" aria-describedby=\"vhc-tip-d\">?<\/button><span class=\"vhc-tip-text\" role=\"tooltip\" id=\"vhc-tip-d\">The arithmetic mean of the two diagonals, if you have already calculated it.<\/span><\/span><\/div>\n<div class=\"vhc-row\">\n<input id=\"vhc-d\" name=\"d\" type=\"number\" inputmode=\"decimal\" step=\"any\" min=\"0\" placeholder=\"e.g. 0.51\" aria-describedby=\"vhc-d-err\">\n<select id=\"vhc-d-unit\" name=\"dUnit\" aria-label=\"Unit of average diagonal\"><option value=\"mm\" selected>mm<\/option><option value=\"um\">&micro;m<\/option><\/select>\n<\/div>\n<span class=\"vhc-error\" id=\"vhc-d-err\" role=\"alert\"><\/span>\n<\/div>\n<\/div>\n<figure class=\"vhc-diagram\">\n<svg viewBox=\"0 0 560 240\" role=\"img\" aria-labelledby=\"vhc-svg-title\" focusable=\"false\">\n<title id=\"vhc-svg-title\">Vickers test: 136 degree diamond pyramid indenter pressed into the specimen under force F, and the square indentation with diagonals d1 and d2<\/title>\n<rect x=\"10\" y=\"10\" width=\"240\" height=\"205\" rx=\"10\" fill=\"#fff\" stroke=\"#e8e8ed\"\/>\n<line x1=\"125\" y1=\"14\" x2=\"125\" y2=\"46\" stroke=\"#0071e3\" stroke-width=\"3\"\/>\n<polygon points=\"117,44 133,44 125,58\" fill=\"#0071e3\"\/>\n<text x=\"136\" y=\"34\" font-size=\"15\" font-weight=\"700\" fill=\"#0058b0\" font-family=\"Arial,sans-serif\">F<\/text>\n<rect x=\"104\" y=\"60\" width=\"42\" height=\"62\" rx=\"3\" fill=\"#c9ced6\" stroke=\"#8a919c\"\/>\n<polygon points=\"75,142 100,122 150,122 175,142 125,162\" fill=\"#d6e8fb\" stroke=\"#0058b0\" stroke-width=\"1.5\"\/>\n<line x1=\"125\" y1=\"122\" x2=\"125\" y2=\"162\" stroke=\"#0058b0\" stroke-width=\".8\" stroke-dasharray=\"3 3\"\/>\n<text x=\"125\" y=\"140\" font-size=\"11\" text-anchor=\"middle\" fill=\"#1d1d1f\" font-family=\"Arial,sans-serif\">136&#176;<\/text>\n<path d=\"M14 150 L95 150 L125 162 L155 150 L246 150 L246 211 L14 211 Z\" fill=\"#e3e7ed\" stroke=\"#8a919c\"\/>\n<text x=\"130\" y=\"192\" font-size=\"12\" text-anchor=\"middle\" fill=\"#5f5f66\" font-family=\"Arial,sans-serif\">Specimen surface<\/text>\n<text x=\"130\" y=\"232\" font-size=\"12\" text-anchor=\"middle\" fill=\"#5f5f66\" font-family=\"Arial,sans-serif\">Side view: diamond pyramid indenter<\/text>\n<rect x=\"280\" y=\"10\" width=\"270\" height=\"205\" rx=\"10\" fill=\"#eef1f5\" stroke=\"#e8e8ed\"\/>\n<polygon id=\"vhc-f1\" points=\"348,105 420,33 420,105\" fill=\"#cfd8e3\"\/>\n<polygon id=\"vhc-f2\" points=\"420,33 492,105 420,105\" fill=\"#dfe6ee\"\/>\n<polygon id=\"vhc-f3\" points=\"492,105 420,177 420,105\" fill=\"#c3cedb\"\/>\n<polygon id=\"vhc-f4\" points=\"420,177 348,105 420,105\" fill=\"#b7c4d3\"\/>\n<polygon id=\"vhc-outline\" points=\"348,105 420,33 492,105 420,177\" fill=\"none\" stroke=\"#3d4a5c\" stroke-width=\"1.5\"\/>\n<line id=\"vhc-l1\" x1=\"348\" y1=\"105\" x2=\"492\" y2=\"105\" stroke=\"#0071e3\" stroke-width=\"1.6\" stroke-dasharray=\"5 4\"\/>\n<line id=\"vhc-l2\" x1=\"420\" y1=\"33\" x2=\"420\" y2=\"177\" stroke=\"#c4291c\" stroke-width=\"1.6\" stroke-dasharray=\"5 4\"\/>\n<g id=\"vhc-dim1\" stroke=\"#0071e3\" stroke-width=\"1.4\"><line id=\"vhc-dim1-l\" x1=\"348\" y1=\"195\" x2=\"492\" y2=\"195\"\/><line id=\"vhc-dim1-a\" x1=\"348\" y1=\"189\" x2=\"348\" y2=\"201\"\/><line id=\"vhc-dim1-b\" x1=\"492\" y1=\"189\" x2=\"492\" y2=\"201\"\/><\/g>\n<text id=\"vhc-dim1-t\" x=\"420\" y=\"210\" font-size=\"13\" font-weight=\"700\" text-anchor=\"middle\" fill=\"#0058b0\" font-family=\"Arial,sans-serif\">d&#8321;<\/text>\n<g id=\"vhc-dim2\" stroke=\"#c4291c\" stroke-width=\"1.4\"><line id=\"vhc-dim2-l\" x1=\"510\" y1=\"33\" x2=\"510\" y2=\"177\"\/><line id=\"vhc-dim2-a\" x1=\"504\" y1=\"33\" x2=\"516\" y2=\"33\"\/><line id=\"vhc-dim2-b\" x1=\"504\" y1=\"177\" x2=\"516\" y2=\"177\"\/><\/g>\n<text id=\"vhc-dim2-t\" x=\"522\" y=\"110\" font-size=\"13\" font-weight=\"700\" fill=\"#c4291c\" font-family=\"Arial,sans-serif\">d&#8322;<\/text>\n<text x=\"415\" y=\"232\" font-size=\"12\" text-anchor=\"middle\" fill=\"#5f5f66\" font-family=\"Arial,sans-serif\">Top view: indentation and diagonals<\/text>\n<\/svg>\n<figcaption id=\"vhc-diag-cap\" aria-live=\"polite\">d&#8321; = 0.500 mm &#183; d&#8322; = 0.520 mm (shape drawn to the measured ratio)<\/figcaption>\n<\/figure>\n<div class=\"vhc-actions\">\n<button type=\"button\" class=\"vhc-btn vhc-btn-primary\" id=\"vhc-calc\">Calculate<\/button>\n<\/div>\n<p class=\"vhc-form-msg\" id=\"vhc-form-msg\" role=\"alert\" aria-live=\"polite\"><\/p>\n<\/section>\n<section class=\"vhc-card vhc-hide\" id=\"vhc-results\" aria-labelledby=\"vhc-h-res\" tabindex=\"-1\" hidden>\n<div class=\"vhc-results-head\">\n<div class=\"vhc-card-title\" id=\"vhc-h-res\"><span class=\"vhc-step\" aria-hidden=\"true\">3<\/span>Results<\/div>\n<div class=\"vhc-tools\">\n<button type=\"button\" class=\"vhc-btn vhc-btn-ghost vhc-btn-small\" id=\"vhc-copy\">Copy Result<\/button>\n<button type=\"button\" class=\"vhc-btn vhc-btn-ghost vhc-btn-small\" id=\"vhc-steps-btn\" aria-expanded=\"false\" aria-controls=\"vhc-steps-box\">Show Calculation Steps<\/button>\n<button type=\"button\" class=\"vhc-btn vhc-btn-ghost vhc-btn-small\" id=\"vhc-csv\">Download CSV<\/button>\n<button type=\"button\" class=\"vhc-btn vhc-btn-ghost vhc-btn-small\" id=\"vhc-print\">Print<\/button>\n<\/div>\n<\/div>\n<div class=\"vhc-main\" aria-live=\"polite\">\n<div class=\"vhc-main-label\"><span>Vickers hardness<\/span><span class=\"vhc-badge vhc-badge-info\" id=\"vhc-r-class\">&#8212;<\/span><\/div>\n<div class=\"vhc-main-value\" id=\"vhc-r-hv\">&#8212;<\/div>\n<div class=\"vhc-main-sub\" id=\"vhc-r-desig-row\">Test designation preview: <span class=\"vhc-desig\" id=\"vhc-r-desig\">&#8212;<\/span> <span id=\"vhc-r-desig-note\"><\/span><\/div>\n<\/div>\n<div class=\"vhc-kpis\">\n<div class=\"vhc-kpi\"><div class=\"vhc-kpi-label\">Applied force<\/div><div class=\"vhc-kpi-value\" id=\"vhc-r-f\">&#8212;<\/div><div class=\"vhc-kpi-sub\" id=\"vhc-r-f-sub\"><\/div><\/div>\n<div class=\"vhc-kpi\"><div class=\"vhc-kpi-label\">Force in kgf<\/div><div class=\"vhc-kpi-value\" id=\"vhc-r-fk\">&#8212;<\/div><div class=\"vhc-kpi-sub\" id=\"vhc-r-fn\"><\/div><\/div>\n<div class=\"vhc-kpi\"><div class=\"vhc-kpi-label\">First diagonal d&#8321;<\/div><div class=\"vhc-kpi-value\" id=\"vhc-r-d1\">&#8212;<\/div><div class=\"vhc-kpi-sub\" id=\"vhc-r-d1-sub\"><\/div><\/div>\n<div class=\"vhc-kpi\"><div class=\"vhc-kpi-label\">Second diagonal d&#8322;<\/div><div class=\"vhc-kpi-value\" id=\"vhc-r-d2\">&#8212;<\/div><div class=\"vhc-kpi-sub\" id=\"vhc-r-d2-sub\"><\/div><\/div>\n<div class=\"vhc-kpi\"><div class=\"vhc-kpi-label\">Average diagonal d<\/div><div class=\"vhc-kpi-value\" id=\"vhc-r-d\">&#8212;<\/div><div class=\"vhc-kpi-sub\" id=\"vhc-r-d-sub\"><\/div><\/div>\n<div class=\"vhc-kpi\"><div class=\"vhc-kpi-label\">Diagonal difference<\/div><div class=\"vhc-kpi-value\" id=\"vhc-r-diff\">&#8212;<\/div><div class=\"vhc-kpi-sub\" id=\"vhc-r-diff-sub\"><\/div><\/div>\n<div class=\"vhc-kpi\"><div class=\"vhc-kpi-label\">Indentation depth<\/div><div class=\"vhc-kpi-value\" id=\"vhc-r-h\">&#8212;<\/div><div class=\"vhc-kpi-sub\">h &#8776; d \/ 7.0<\/div><\/div>\n<div class=\"vhc-kpi\"><div class=\"vhc-kpi-label\">Min. specimen thickness<\/div><div class=\"vhc-kpi-value\" id=\"vhc-r-t\">&#8212;<\/div><div class=\"vhc-kpi-sub\">1.5 &#215; d (ISO 6507-1)<\/div><\/div>\n<\/div>\n<div class=\"vhc-box\">\n<p class=\"vhc-box-title\">Calculation formula<\/p>\n<p class=\"vhc-formula\" id=\"vhc-r-formula\">HV = 1.8544 &#215; F \/ d&#178;<\/p>\n<p class=\"vhc-small\">F in kgf, d in mm. Equivalent SI form: HV = 0.1891 &#215; F \/ d&#178; with F in N. 1.8544 = 2&#183;sin(136&#176;\/2), rounded.<\/p>\n<\/div>\n<div class=\"vhc-box vhc-hide\" id=\"vhc-steps-box\" hidden>\n<p class=\"vhc-box-title\">Step-by-step calculation<\/p>\n<ol class=\"vhc-steps\" id=\"vhc-steps\"><\/ol>\n<\/div>\n<div class=\"vhc-alerts\" id=\"vhc-alerts\"><\/div>\n<div class=\"vhc-box\">\n<p class=\"vhc-box-title\">Approximate hardness conversions <span class=\"vhc-badge vhc-badge-warn\">Estimate<\/span><\/p>\n<div class=\"vhc-tablewrap\"><table class=\"vhc-table\"><thead><tr><th scope=\"col\">Scale<\/th><th scope=\"col\">Approx. value<\/th><th scope=\"col\">Basis<\/th><\/tr><\/thead><tbody id=\"vhc-conv\"><\/tbody><\/table><\/div>\n<p class=\"vhc-small\">Interpolated from ASTM E140 conversion tables for non-austenitic steels (Table 1 for HRC\/HBW, Table 2 for HRB). Not valid for austenitic stainless steels, non-ferrous metals or case-hardened surfaces, and not a substitute for direct testing. Check values against the current edition of the standard.<\/p>\n<\/div>\n<\/section>\n<\/form>\n<div class=\"vhc-toast\" id=\"vhc-toast\" role=\"status\" aria-live=\"polite\"><\/div>\n<script>\n(function () {\n  \"use strict\";\n  var roots = document.querySelectorAll(\".vhc-root\");\n  for (var ri = 0; ri < roots.length; ri++) {\n    if (roots[ri].getAttribute(\"data-vhc-init\") !== \"1\") { init(roots[ri]); }\n  }\n  function init(root) {\n    root.setAttribute(\"data-vhc-init\", \"1\");\n    \/* ===== Unique IDs so several calculators can share one page ===== *\/\n    var n = window.vhcInstanceCount || 0;\n    window.vhcInstanceCount = n + 1;\n    var sfx = n === 0 ? \"\" : \"-\" + (n + 1);\n    if (sfx) {\n      if (root.id) { root.id = root.id + sfx; }\n      var all = root.querySelectorAll(\"*\"), attrs = [\"for\", \"aria-describedby\", \"aria-labelledby\", \"aria-controls\"];\n      for (var a = 0; a < all.length; a++) {\n        var nd = all[a];\n        if (nd.id) { nd.id = nd.id + sfx; }\n        for (var b = 0; b < attrs.length; b++) {\n          var v = nd.getAttribute(attrs[b]);\n          if (v) { nd.setAttribute(attrs[b], v.split(\/\\s+\/).map(function (t) { return t.indexOf(\"vhc-\") === 0 ? t + sfx : t; }).join(\" \")); }\n        }\n        if (nd.getAttribute(\"name\") === \"vhc-mode\") { nd.setAttribute(\"name\", \"vhc-mode\" + sfx); }\n      }\n    }\n    function q(id) { return root.querySelector(\"#vhc-\" + id + sfx); }\n    \/* ===================== CONSTANTS ===================== *\/\n    var KGF = 9.80665;          \/* 1 kgf = 9.80665 N (exact) *\/\n    var COEF = 1.8544;          \/* rounded 2*sin(68 deg), used with F in kgf and d in mm *\/\n    var COEF_N = 0.1891;        \/* rounded 1.8544 \/ 9.80665, used with F in N (shown for reference) *\/\n    var DEPTH_RATIO = 2 * Math.SQRT2 * Math.tan(68 * Math.PI \/ 180); \/* d \/ h = 7.0006 *\/\n    \/* Standard test forces in kgf (ISO 6507-1; 120 kgf from ASTM E92) *\/\n    var STD_F = [0.01, 0.015, 0.02, 0.025, 0.05, 0.1, 0.2, 0.3, 0.5, 1, 2, 3, 5, 10, 20, 30, 50, 100, 120];\n    \/* Approximate conversions for non-austenitic steels after ASTM E140 Table 1: [HRC, HV, HBW 10\/3000] *\/\n    var CONV_C = [\n      [20,238,226],[21,243,231],[22,248,237],[23,254,243],[24,260,247],[25,266,253],[26,272,258],[27,279,264],\n      [28,286,271],[29,294,279],[30,302,286],[31,310,294],[32,318,301],[33,327,311],[34,336,319],[35,345,327],\n      [36,354,336],[37,363,344],[38,372,353],[39,382,362],[40,392,371],[41,402,381],[42,412,390],[43,423,400],\n      [44,434,409],[45,446,421],[46,458,432],[47,471,443],[48,484,455],[49,498,469],[50,513,481],[51,528,496],\n      [52,544,512],[53,560,525],[54,577,543],[55,595,560],[56,613,577],[57,633,595],[58,653,615],[59,674,634],\n      [60,697,654],[61,720,670],[62,746,688],[63,772,706],[64,800,722],[65,832,739],[66,865,null],[67,900,null],[68,940,null]\n    ];\n    \/* Approximate conversions for non-austenitic steels after ASTM E140 Table 2: [HRB, HV] *\/\n    var CONV_B = [\n      [60,107],[61,108],[62,110],[63,112],[64,114],[65,116],[66,117],[67,119],[68,121],[69,123],[70,125],\n      [71,127],[72,130],[73,132],[74,135],[75,137],[76,139],[77,141],[78,144],[79,147],[80,150],\n      [81,153],[82,156],[83,159],[84,162],[85,165],[86,169],[87,172],[88,176],[89,180],[90,185],\n      [91,190],[92,195],[93,200],[94,205],[95,210],[96,216],[97,222],[98,228],[99,234],[100,240]\n    ];\n    \/* ===================== ENGINE (pure functions) ===================== *\/\n    function forceToKgf(v, unit) { return unit === \"kgf\" ? v : unit === \"N\" ? v \/ KGF : unit === \"gf\" ? v \/ 1000 : v \/ 1000 \/ KGF; }\n    function kgfToUnit(v, unit) { return unit === \"kgf\" ? v : unit === \"N\" ? v * KGF : unit === \"gf\" ? v * 1000 : v * KGF * 1000; }\n    function lenToMm(v, unit) { return unit === \"um\" ? v \/ 1000 : v; }\n    function vickers(Fkgf, dmm) { return COEF * Fkgf \/ (dmm * dmm); }\n    function classify(Fkgf) {\n      var t = 1e-6;\n      if (Fkgf < 0.01 * (1 - t)) { return { key: \"below\", short: \"Below ISO range\", text: \"Test force below the ISO 6507-1 microhardness range (HV 0.01, 0.09807 N). Instrumented indentation (ISO 14577) is normally used at such forces.\" }; }\n      if (Fkgf < 0.2 * (1 - t)) { return { key: \"micro\", short: \"Microhardness\", text: \"Vickers microhardness test (HV 0.01 to below HV 0.2; 0.09807 N to below 1.961 N), ISO 6507-1. ASTM E384 covers 1 gf to 1000 gf.\" }; }\n      if (Fkgf < 5 * (1 - t)) { return { key: \"low\", short: \"Low-force\", text: \"Low-force Vickers hardness test (HV 0.2 to below HV 5; 1.961 N to below 49.03 N), ISO 6507-1.\" }; }\n      if (Fkgf <= 100 * (1 + t)) { return { key: \"std\", short: \"Conventional\", text: \"Conventional Vickers hardness test (HV 5 to HV 100; 49.03 N to 980.7 N), ISO 6507-1.\" }; }\n      if (Fkgf <= 120 * (1 + t)) { return { key: \"astm\", short: \"Above ISO range\", text: \"Above the ISO 6507-1 maximum of HV 100, but within the ASTM E92 range (up to 120 kgf).\" }; }\n      return { key: \"above\", short: \"Above standard range\", text: \"Test force above the ranges covered by ISO 6507-1 (100 kgf) and ASTM E92 (120 kgf).\" };\n    }\n    function stdForce(Fkgf) {\n      for (var i = 0; i < STD_F.length; i++) { if (Math.abs(Fkgf - STD_F[i]) <= STD_F[i] * 0.001) { return STD_F[i]; } }\n      return null;\n    }\n    function reportHV(hv) { return hv >= 100 ? String(Math.round(hv)) : String(Number(hv.toPrecision(3))); }\n    function interp(table, xi, yi, x) {\n      var rows = table.filter(function (r) { return r[yi] !== null; });\n      if (x < rows[0][xi] || x > rows[rows.length - 1][xi]) { return null; }\n      for (var i = 0; i < rows.length - 1; i++) {\n        var a = rows[i], b = rows[i + 1];\n        if (x >= a[xi] ? x <= b[xi] : false) { return a[yi] + (b[yi] - a[yi]) * (x - a[xi]) \/ (b[xi] - a[xi]); }\n      }\n      return rows[rows.length - 1][yi];\n    }\n    function calculate(inp) {\n      var r = {};\n      r.Fkgf = forceToKgf(inp.F, inp.unit);\n      r.FN = r.Fkgf * KGF;\n      if (inp.mode === \"two\") {\n        r.d1 = lenToMm(inp.d1, inp.d1u); r.d2 = lenToMm(inp.d2, inp.d2u);\n        r.d = (r.d1 + r.d2) \/ 2;\n        r.diffPct = Math.abs(r.d1 - r.d2) \/ r.d * 100;\n      } else {\n        r.d1 = null; r.d2 = null; r.d = lenToMm(inp.d, inp.du); r.diffPct = null;\n      }\n      r.d2sq = r.d * r.d;\n      r.num = COEF * r.Fkgf;\n      r.hv = vickers(r.Fkgf, r.d);\n      r.hvN = COEF_N * r.FN \/ r.d2sq;\n      r.depth = r.d \/ DEPTH_RATIO;\n      r.cls = classify(r.Fkgf);\n      r.std = stdForce(r.Fkgf);\n      r.hrc = interp(CONV_C, 1, 0, r.hv);\n      r.hbw = interp(CONV_C, 1, 2, r.hv);\n      r.hrb = interp(CONV_B, 1, 0, r.hv);\n      return r;\n    }\n    root.vhcEngine = { calculate: calculate, vickers: vickers, forceToKgf: forceToKgf, classify: classify };\n    \/* ===================== HELPERS ===================== *\/\n    function fmt(v, dec) {\n      if (v === null || v === undefined || !isFinite(v)) { return \"\u2014\"; }\n      var r = Number(v.toFixed(dec)); if (r === 0) { r = 0; }\n      return r.toLocaleString(\"en-US\", { minimumFractionDigits: dec, maximumFractionDigits: dec });\n    }\n    function smart(v) {\n      if (v === null || !isFinite(v)) { return \"\u2014\"; }\n      var a = Math.abs(v);\n      if (a !== 0) { if (a < 1e-4) { return v.toExponential(4); } }\n      return String(Number(v.toPrecision(6)));\n    }\n    function uLabel(u) { return u === \"um\" ? \"\u00b5m\" : u; }\n    function mk(tag, cls, text) { var e = document.createElement(tag); if (cls) { e.className = cls; } if (text !== undefined) { e.textContent = text; } return e; }\n    function clear(e) { while (e.firstChild) { e.removeChild(e.firstChild); } }\n    function setVisible(node, on) {\n      if (on) { node.classList.remove(\"vhc-hide\"); node.removeAttribute(\"hidden\"); node.style.removeProperty(\"display\"); }\n      else { node.classList.add(\"vhc-hide\"); node.setAttribute(\"hidden\", \"\"); node.style.setProperty(\"display\", \"none\", \"important\"); }\n    }\n    function num(input) {\n      var s = String(input.value).trim();\n      if (s === \"\") { return null; }\n      var v = Number(s);\n      return isFinite(v) ? v : NaN;\n    }\n    var el = {\n      force: q(\"force\"), unit: q(\"force-unit\"), forceErr: q(\"force-err\"), dwell: q(\"dwell\"), dwellErr: q(\"dwell-err\"),\n      prec: q(\"prec\"), thr: q(\"thr\"), thrErr: q(\"thr-err\"),\n      d1Wrap: q(\"d1-wrap\"), d1: q(\"d1\"), d1u: q(\"d1-unit\"), d1Err: q(\"d1-err\"),\n      d2Wrap: q(\"d2-wrap\"), d2: q(\"d2\"), d2u: q(\"d2-unit\"), d2Err: q(\"d2-err\"),\n      avg: q(\"avg\"), avgVal: q(\"avg-val\"), dWrap: q(\"d-wrap\"), d: q(\"d\"), du: q(\"d-unit\"), dErr: q(\"d-err\"),\n      calc: q(\"calc\"), formMsg: q(\"form-msg\"),\n      results: q(\"results\"), rClass: q(\"r-class\"), rHv: q(\"r-hv\"), rDesig: q(\"r-desig\"), rDesigNote: q(\"r-desig-note\"),\n      rF: q(\"r-f\"), rFSub: q(\"r-f-sub\"), rFk: q(\"r-fk\"), rFn: q(\"r-fn\"), rD1: q(\"r-d1\"), rD1Sub: q(\"r-d1-sub\"),\n      rD2: q(\"r-d2\"), rD2Sub: q(\"r-d2-sub\"), rD: q(\"r-d\"), rDSub: q(\"r-d-sub\"), rDiff: q(\"r-diff\"), rDiffSub: q(\"r-diff-sub\"),\n      rH: q(\"r-h\"), rT: q(\"r-t\"), stepsBtn: q(\"steps-btn\"), stepsBox: q(\"steps-box\"), steps: q(\"steps\"),\n      alerts: q(\"alerts\"), conv: q(\"conv\"), copy: q(\"copy\"), csv: q(\"csv\"), print: q(\"print\"), toast: q(\"toast\"),\n      cap: q(\"diag-cap\")\n    };\n    var state = { shown: false, rows: [], steps: [], summary: \"\" };\n    function mode() { var r = root.querySelector('input[name=\"vhc-mode' + sfx + '\"]:checked'); return r ? r.value : \"two\"; }\n    function setErr(input, errEl, msg) {\n      errEl.textContent = msg || \"\";\n      if (msg) { input.classList.add(\"vhc-invalid\"); input.setAttribute(\"aria-invalid\", \"true\"); }\n      else { input.classList.remove(\"vhc-invalid\"); input.removeAttribute(\"aria-invalid\"); }\n      return !msg;\n    }\n    function positiveMsg(v, name) {\n      if (v === null) { return \"Enter the \" + name + \".\"; }\n      if (isNaN(v)) { return \"Enter a valid number.\"; }\n      if (v <= 0) { return \"The \" + name + \" must be greater than zero.\"; }\n      return \"\";\n    }\n    \/* ===================== VALIDATION ===================== *\/\n    function validateForce() { return setErr(el.force, el.forceErr, positiveMsg(num(el.force), \"test force\")); }\n    function validateDwell() {\n      var v = num(el.dwell);\n      if (v === null) { return setErr(el.dwell, el.dwellErr, \"\"); }\n      if (isNaN(v)) { return setErr(el.dwell, el.dwellErr, \"Enter a valid number, or leave blank.\"); }\n      if (v <= 0) { return setErr(el.dwell, el.dwellErr, \"Dwell time must be greater than zero, or leave blank.\"); }\n      return setErr(el.dwell, el.dwellErr, \"\");\n    }\n    function validateThr() {\n      var v = num(el.thr), m = \"\";\n      if (v === null) { m = \"Enter a warning threshold (e.g. 5).\"; }\n      else if (isNaN(v)) { m = \"Enter a valid number.\"; }\n      else if (v < 0) { m = \"The threshold cannot be negative.\"; }\n      else if (v > 100) { m = \"Enter a value from 0 to 100%.\"; }\n      return setErr(el.thr, el.thrErr, m);\n    }\n    function validateLen(input, errEl, name) { return setErr(input, errEl, positiveMsg(num(input), name)); }\n    function validateIndent() {\n      if (mode() === \"two\") {\n        setErr(el.d, el.dErr, \"\");\n        var a = validateLen(el.d1, el.d1Err, \"first diagonal d\u2081\");\n        var b = validateLen(el.d2, el.d2Err, \"second diagonal d\u2082\");\n        return a ? b : false;\n      }\n      setErr(el.d1, el.d1Err, \"\"); setErr(el.d2, el.d2Err, \"\");\n      return validateLen(el.d, el.dErr, \"average diagonal\");\n    }\n    function validateAll() {\n      var ok = [validateForce(), validateDwell(), validateThr(), validateIndent()];\n      for (var i = 0; i < ok.length; i++) { if (!ok[i]) { return false; } }\n      return true;\n    }\n    function readInput() {\n      return {\n        F: num(el.force), unit: el.unit.value, dwell: num(el.dwell), prec: Number(el.prec.value), thr: num(el.thr), mode: mode(),\n        d1: num(el.d1), d1u: el.d1u.value, d2: num(el.d2), d2u: el.d2u.value, d: num(el.d), du: el.du.value\n      };\n    }\n    \/* ===================== DIAGRAM ===================== *\/\n    function validLen(input, unitSel) { var v = num(input); return (v === null || isNaN(v) || v <= 0) ? null : lenToMm(v, unitSel.value); }\n    function pts(arr) { return arr.map(function (p) { return p[0] + \",\" + p[1]; }).join(\" \"); }\n    function setLine(id, x1, y1, x2, y2) { var l = q(id); l.setAttribute(\"x1\", x1); l.setAttribute(\"y1\", y1); l.setAttribute(\"x2\", x2); l.setAttribute(\"y2\", y2); }\n    function updateDiagram() {\n      var a, b, cap;\n      if (mode() === \"two\") {\n        a = validLen(el.d1, el.d1u); b = validLen(el.d2, el.d2u);\n        cap = \"d\u2081 = \" + (a === null ? \"\u2014\" : smart(a) + \" mm\") + \" \u00b7 d\u2082 = \" + (b === null ? \"\u2014\" : smart(b) + \" mm\") + \" (shape drawn to the measured ratio)\";\n      } else {\n        a = validLen(el.d, el.du); b = a;\n        cap = \"d = \" + (a === null ? \"\u2014\" : smart(a) + \" mm\") + \" (average diagonal, drawn as a square)\";\n      }\n      if (a === null || b === null) { a = 1; b = 1; }\n      var m = Math.max(a, b), cx = 420, cy = 105, H = 72;\n      var hx = Math.max(24, H * a \/ m), hy = Math.max(24, H * b \/ m);\n      var L = [cx - hx, cy], T = [cx, cy - hy], R = [cx + hx, cy], B = [cx, cy + hy], C = [cx, cy];\n      q(\"f1\").setAttribute(\"points\", pts([L, T, C])); q(\"f2\").setAttribute(\"points\", pts([T, R, C]));\n      q(\"f3\").setAttribute(\"points\", pts([R, B, C])); q(\"f4\").setAttribute(\"points\", pts([B, L, C]));\n      q(\"outline\").setAttribute(\"points\", pts([L, T, R, B]));\n      setLine(\"l1\", L[0], cy, R[0], cy); setLine(\"l2\", cx, T[1], cx, B[1]);\n      var yd = cy + H + 18;\n      setLine(\"dim1-l\", L[0], yd, R[0], yd); setLine(\"dim1-a\", L[0], yd - 6, L[0], yd + 6); setLine(\"dim1-b\", R[0], yd - 6, R[0], yd + 6);\n      var xd = cx + H + 18;\n      setLine(\"dim2-l\", xd, T[1], xd, B[1]); setLine(\"dim2-a\", xd - 6, T[1], xd + 6, T[1]); setLine(\"dim2-b\", xd - 6, B[1], xd + 6, B[1]);\n      el.cap.textContent = cap;\n    }\n    function updateAvg() {\n      var a = validLen(el.d1, el.d1u), b = validLen(el.d2, el.d2u);\n      el.avgVal.textContent = (a === null || b === null) ? \"\u2014\" : smart((a + b) \/ 2) + \" mm\";\n    }\n    \/* ===================== RENDER ===================== *\/\n    function kpi(valEl, subEl, val, sub) { valEl.textContent = val; if (subEl) { subEl.textContent = sub || \"\"; } }\n    function addAlert(text, kind) { el.alerts.appendChild(mk(\"div\", \"vhc-alert \" + (kind === \"info\" ? \"vhc-alert-info\" : \"vhc-alert-warn\"), text)); }\n    function render(inp, r) {\n      var p = inp.prec, rows = [], steps = [], warns = [];\n      \/* Main value *\/\n      el.rHv.textContent = fmt(r.hv, p);\n      el.rHv.appendChild(mk(\"span\", \"\", \"HV\"));\n      el.rClass.textContent = r.cls.short;\n      el.rClass.className = \"vhc-badge \" + ((r.cls.key === \"std\" || r.cls.key === \"low\" || r.cls.key === \"micro\") ? \"vhc-badge-info\" : \"vhc-badge-warn\");\n      \/* Designation *\/\n      var desig = \"\", note = \"\";\n      var dwellStd = inp.dwell === null ? true : (inp.dwell >= 10 ? inp.dwell <= 15 : false);\n      if (r.std !== null) {\n        desig = reportHV(r.hv) + \" HV \" + String(r.std) + (dwellStd ? \"\" : \"\/\" + String(Number(inp.dwell.toPrecision(4))));\n        note = r.std === 120 ? \"(120 kgf is an ASTM E92 force, not an ISO 6507-1 force.)\" : (dwellStd ? \"Hardness number, HV symbol and test force in kgf.\" : \"Includes the non-standard dwell time in seconds.\");\n      } else {\n        desig = \"n\/a\";\n        note = \"The force does not match a standard Vickers test force, so no conventional designation is shown. Report the hardness together with the actual force (\" + smart(r.Fkgf) + \" kgf).\";\n      }\n      el.rDesig.textContent = desig;\n      el.rDesigNote.textContent = note;\n      \/* KPIs *\/\n      kpi(el.rF, el.rFSub, smart(inp.F) + \" \" + inp.unit, \"As entered\");\n      kpi(el.rFk, el.rFn, smart(r.Fkgf) + \" kgf\", \"= \" + smart(r.FN) + \" N\");\n      if (inp.mode === \"two\") {\n        kpi(el.rD1, el.rD1Sub, smart(r.d1) + \" mm\", inp.d1u === \"um\" ? \"Entered \" + smart(inp.d1) + \" \u00b5m\" : \"= \" + smart(r.d1 * 1000) + \" \u00b5m\");\n        kpi(el.rD2, el.rD2Sub, smart(r.d2) + \" mm\", inp.d2u === \"um\" ? \"Entered \" + smart(inp.d2) + \" \u00b5m\" : \"= \" + smart(r.d2 * 1000) + \" \u00b5m\");\n        kpi(el.rDiff, el.rDiffSub, fmt(r.diffPct, 2) + \"%\", \"of average d (warning above \" + smart(inp.thr) + \"%)\");\n      } else {\n        kpi(el.rD1, el.rD1Sub, \"n\/a\", \"Average entered directly\");\n        kpi(el.rD2, el.rD2Sub, \"n\/a\", \"Average entered directly\");\n        kpi(el.rDiff, el.rDiffSub, \"n\/a\", \"Needs both diagonals\");\n      }\n      kpi(el.rD, el.rDSub, smart(r.d) + \" mm\", \"= \" + smart(r.d * 1000) + \" \u00b5m\");\n      kpi(el.rH, null, String(Number((r.depth * 1000).toPrecision(4))) + \" \u00b5m\");\n      kpi(el.rT, null, smart(1.5 * r.d) + \" mm\");\n      \/* Steps *\/\n      var fStep = inp.unit === \"kgf\" ? \"F = \" + smart(inp.F) + \" kgf (already in kgf)\"\n        : inp.unit === \"N\" ? \"F = \" + smart(inp.F) + \" N \u00f7 9.80665 = \" + smart(r.Fkgf) + \" kgf\"\n        : inp.unit === \"gf\" ? \"F = \" + smart(inp.F) + \" gf \u00f7 1000 = \" + smart(r.Fkgf) + \" kgf\"\n        : \"F = \" + smart(inp.F) + \" mN \u00f7 1000 \u00f7 9.80665 = \" + smart(r.Fkgf) + \" kgf\";\n      steps.push([\"Convert the test force to kgf\", fStep]);\n      function lenStep(sym, v, u, mm) { return u === \"um\" ? sym + \" = \" + smart(v) + \" \u00b5m \u00f7 1000 = \" + smart(mm) + \" mm\" : sym + \" = \" + smart(v) + \" mm\"; }\n      if (inp.mode === \"two\") {\n        steps.push([\"Convert the diagonals to mm\", lenStep(\"d\u2081\", inp.d1, inp.d1u, r.d1) + \";  \" + lenStep(\"d\u2082\", inp.d2, inp.d2u, r.d2)]);\n        steps.push([\"Calculate the average diagonal\", \"d = (\" + smart(r.d1) + \" + \" + smart(r.d2) + \") \/ 2 = \" + smart(r.d) + \" mm\"]);\n      } else {\n        steps.push([\"Convert the average diagonal to mm\", lenStep(\"d\", inp.d, inp.du, r.d)]);\n      }\n      steps.push([\"Square the average diagonal\", \"d\u00b2 = \" + smart(r.d) + \" \u00d7 \" + smart(r.d) + \" = \" + smart(r.d2sq) + \" mm\u00b2\"]);\n      steps.push([\"Apply the Vickers equation\", \"HV = 1.8544 \u00d7 \" + smart(r.Fkgf) + \" \/ \" + smart(r.d2sq) + \" = \" + smart(r.num) + \" \/ \" + smart(r.d2sq) + \" = \" + fmt(r.hv, p) + \" HV\"]);\n      steps.push([\"Cross-check with the SI form\", \"HV = 0.1891 \u00d7 \" + smart(r.FN) + \" N \/ \" + smart(r.d2sq) + \" = \" + fmt(r.hvN, p) + \" HV (difference comes only from coefficient rounding)\"]);\n      clear(el.steps);\n      steps.forEach(function (s) { var li = mk(\"li\", \"\", s[0]); li.appendChild(mk(\"span\", \"\", s[1])); el.steps.appendChild(li); });\n      \/* Alerts *\/\n      clear(el.alerts);\n      if (inp.mode === \"two\") {\n        if (r.diffPct > inp.thr) {\n          warns.push(\"The diagonals differ by \" + fmt(r.diffPct, 2) + \"% of the average, above your \" + smart(inp.thr) + \"% warning level. Check specimen tilt, surface preparation and measurement. This is a screening aid only \u2014 acceptance must follow the applicable standard (for example, ISO 6507-1 asks for a difference above 5% on flat surfaces to be stated in the test report).\");\n        }\n      }\n      if (r.d < 0.020) { warns.push(\"The average diagonal is below 0.020 mm (20 \u00b5m), the lower limit of the diagonal range in ISO 6507-1. Measurement uncertainty is high for such small indentations.\"); }\n      if (r.d > 1.400) { warns.push(\"The average diagonal is above 1.400 mm, the upper limit of the diagonal range in ISO 6507-1. Check the force and diagonal units.\"); }\n      if (r.cls.key === \"below\" || r.cls.key === \"above\" || r.cls.key === \"astm\") { warns.push(r.cls.text); }\n      if (inp.dwell !== null) { if (!dwellStd) { warns.push(\"Dwell time of \" + smart(inp.dwell) + \" s is outside the standard 10\u201315 s; it is added to the designation.\"); } }\n      warns.forEach(function (w) { addAlert(w, \"warn\"); });\n      if (r.cls.key === \"std\" || r.cls.key === \"low\" || r.cls.key === \"micro\") { addAlert(r.cls.text, \"info\"); }\n      \/* Conversions *\/\n      clear(el.conv);\n      var conv = [\n        [\"Rockwell C (HRC)\", r.hrc === null ? null : fmt(r.hrc, 1) + \" HRC\", \"ASTM E140 Table 1, valid for about 238\u2013940 HV\"],\n        [\"Brinell (HBW 10\/3000)\", r.hbw === null ? null : Math.round(r.hbw) + \" HBW\", \"ASTM E140 Table 1, valid for about 238\u2013832 HV\"],\n        [\"Rockwell B (HRB)\", r.hrb === null ? null : fmt(r.hrb, 1) + \" HRB\", \"ASTM E140 Table 2, valid for about 107\u2013240 HV\"]\n      ];\n      conv.forEach(function (c) {\n        var tr = document.createElement(\"tr\");\n        tr.appendChild(mk(\"td\", \"\", c[0]));\n        tr.appendChild(mk(\"td\", \"vhc-num\", c[1] === null ? \"Outside table range\" : \"\u2248 \" + c[1]));\n        tr.appendChild(mk(\"td\", \"\", c[2]));\n        el.conv.appendChild(tr);\n      });\n      \/* Export rows *\/\n      rows.push([\"Vickers hardness\", fmt(r.hv, p) + \" HV\"]);\n      rows.push([\"Test designation\", desig]);\n      rows.push([\"Test classification\", r.cls.text]);\n      rows.push([\"Applied test force\", smart(inp.F) + \" \" + inp.unit]);\n      rows.push([\"Force (kgf)\", smart(r.Fkgf)]);\n      rows.push([\"Force (N)\", smart(r.FN)]);\n      if (inp.dwell !== null) { rows.push([\"Dwell time (s)\", smart(inp.dwell)]); }\n      rows.push([\"Measurement mode\", inp.mode === \"two\" ? \"Two-diagonal measurement\" : \"Average diagonal input\"]);\n      if (inp.mode === \"two\") {\n        rows.push([\"First diagonal d1\", smart(inp.d1) + \" \" + uLabel(inp.d1u) + \" (\" + smart(r.d1) + \" mm)\"]);\n        rows.push([\"Second diagonal d2\", smart(inp.d2) + \" \" + uLabel(inp.d2u) + \" (\" + smart(r.d2) + \" mm)\"]);\n        rows.push([\"Diagonal difference\", fmt(r.diffPct, 2) + \"% of average\"]);\n      }\n      rows.push([\"Average diagonal d (mm)\", smart(r.d)]);\n      rows.push([\"d squared (mm2)\", smart(r.d2sq)]);\n      rows.push([\"Formula\", \"HV = 1.8544 x F \/ d^2 (F in kgf, d in mm)\"]);\n      rows.push([\"Indentation depth (approx.)\", String(Number((r.depth * 1000).toPrecision(4))) + \" um\"]);\n      rows.push([\"Min. specimen thickness (1.5d)\", smart(1.5 * r.d) + \" mm\"]);\n      conv.forEach(function (c) { rows.push([c[0] + \" (approx.)\", c[1] === null ? \"Outside table range\" : c[1]]); });\n      warns.forEach(function (w) { rows.push([\"Warning\", w]); });\n      rows.push([\"Note\", \"Calculated value only; not a certified or standards-verified test result.\"]);\n      state.rows = rows; state.steps = steps;\n      var lines = [\"Vickers Hardness (HV) Calculation\", \"Result: \" + fmt(r.hv, p) + \" HV\" + (r.std !== null ? \"  (\" + desig + \")\" : \"\")];\n      rows.slice(2).forEach(function (rw) { lines.push(rw[0] + \": \" + rw[1]); });\n      lines.push(\"\", \"Calculation steps:\");\n      steps.forEach(function (s, i) { lines.push((i + 1) + \". \" + s[0] + \": \" + s[1]); });\n      state.summary = lines.join(\"\\n\");\n    }\n    function onCalculate(silent) {\n      el.formMsg.textContent = \"\";\n      if (!validateAll()) {\n        setVisible(el.results, false);\n        if (!silent) {\n          el.formMsg.textContent = \"Please correct the highlighted fields.\";\n          var first = root.querySelector(\".vhc-invalid\"); if (first) { first.focus(); }\n        }\n        return;\n      }\n      var inp = readInput(), r = calculate(inp);\n      if (!isFinite(r.hv) || r.hv <= 0) {\n        setVisible(el.results, false);\n        el.formMsg.textContent = \"These values cannot produce a valid result. Check the force and diagonal values.\";\n        return;\n      }\n      render(inp, r);\n      setVisible(el.results, true);\n      state.shown = true;\n      if (!silent) {\n        try { el.results.focus({ preventScroll: true }); } catch (e) { \/* ignore *\/ }\n        if (el.results.scrollIntoView) { el.results.scrollIntoView({ behavior: \"smooth\", block: \"nearest\" }); }\n      }\n    }\n    function live() { updateAvg(); updateDiagram(); if (state.shown) { onCalculate(true); } }\n    \/* ===================== TOOLS ===================== *\/\n    var toastTimer = null;\n    function toast(msg) {\n      el.toast.textContent = msg; el.toast.classList.add(\"vhc-show\");\n      if (toastTimer) { clearTimeout(toastTimer); }\n      toastTimer = setTimeout(function () { el.toast.classList.remove(\"vhc-show\"); }, 2200);\n    }\n    function fallbackCopy(text) {\n      var ta = document.createElement(\"textarea\");\n      ta.value = text; ta.setAttribute(\"readonly\", \"\"); ta.style.position = \"fixed\"; ta.style.top = \"-1000px\"; ta.style.opacity = \"0\";\n      document.body.appendChild(ta); ta.select();\n      var ok = false;\n      try { ok = document.execCommand(\"copy\"); } catch (e) { ok = false; }\n      document.body.removeChild(ta);\n      toast(ok ? \"Result copied to clipboard\" : \"Copy failed \u2014 please select and copy the result manually\");\n    }\n    function copyResult() {\n      if (!state.summary) { return; }\n      if (navigator.clipboard ? (window.isSecureContext ? typeof navigator.clipboard.writeText === \"function\" : false) : false) {\n        navigator.clipboard.writeText(state.summary).then(function () { toast(\"Result copied to clipboard\"); }, function () { fallbackCopy(state.summary); });\n      } else { fallbackCopy(state.summary); }\n    }\n    function csvCell(s) { s = String(s); return \/[\",\\n]\/.test(s) ? '\"' + s.replace(\/\"\/g, '\"\"') + '\"' : s; }\n    function downloadCsv() {\n      if (!state.rows.length) { return; }\n      var lines = [\"Parameter,Value\"];\n      state.rows.forEach(function (r) { lines.push(csvCell(r[0]) + \",\" + csvCell(r[1])); });\n      state.steps.forEach(function (s, i) { lines.push(csvCell(\"Step \" + (i + 1) + \": \" + s[0]) + \",\" + csvCell(s[1])); });\n      var text = \"\ufeff\" + lines.join(\"\\r\\n\"), name = \"vickers-hardness-result.csv\";\n      try {\n        var blob = new Blob([text], { type: \"text\/csv;charset=utf-8\" });\n        if (window.navigator.msSaveOrOpenBlob) { window.navigator.msSaveOrOpenBlob(blob, name); return; }\n        var url = URL.createObjectURL(blob), link = document.createElement(\"a\");\n        link.href = url; link.download = name; link.style.display = \"none\";\n        document.body.appendChild(link); link.click(); document.body.removeChild(link);\n        setTimeout(function () { URL.revokeObjectURL(url); }, 1000);\n        toast(\"CSV downloaded\");\n      } catch (e) {\n        toast(\"Download is not supported in this browser\");\n      }\n    }\n    function printSummary() {\n      if (!state.rows.length) { return; }\n      var w = null;\n      try { w = window.open(\"\", \"_blank\"); } catch (e) { w = null; }\n      if (!w) { toast(\"Please allow pop-ups to print the summary\"); return; }\n      var d = w.document;\n      d.open(); d.write(\"<!DOCTYPE html><html><head><meta charset='utf-8'><title>Vickers Hardness Calculation<\/title><\/head><body><\/body><\/html>\"); d.close();\n      var st = d.createElement(\"style\");\n      st.textContent = \"body{font-family:Arial,Helvetica,sans-serif;color:#111;margin:32px;font-size:13px}h1{font-size:20px;margin:0 0 4px}.big{font-size:28px;font-weight:700;margin:12px 0}table{border-collapse:collapse;width:100%;margin:12px 0}td{border-bottom:1px solid #ddd;padding:6px 8px;vertical-align:top}td:first-child{font-weight:700;width:38%}ol{padding-left:20px}li{margin-bottom:6px}.m{font-family:Consolas,monospace;color:#444}.n{color:#666;font-size:11px;margin-top:16px}\";\n      d.head.appendChild(st);\n      function add(parent, tag, text, cls) { var e = d.createElement(tag); if (text !== undefined) { e.textContent = text; } if (cls) { e.className = cls; } parent.appendChild(e); return e; }\n      add(d.body, \"h1\", \"Vickers Hardness (HV) Calculation Summary\");\n      add(d.body, \"div\", \"Generated \" + new Date().toLocaleString(\"en-US\"), \"n\");\n      add(d.body, \"div\", state.rows[0][1], \"big\");\n      var tb = add(d.body, \"table\");\n      state.rows.forEach(function (r) { var tr = add(tb, \"tr\"); add(tr, \"td\", r[0]); add(tr, \"td\", r[1]); });\n      add(d.body, \"h2\", \"Calculation steps\");\n      var ol = add(d.body, \"ol\");\n      state.steps.forEach(function (s) { var li = add(ol, \"li\", s[0]); add(li, \"div\", s[1], \"m\"); });\n      add(d.body, \"p\", \"This summary is calculated from the entered test force and diagonal measurements. It does not verify force calibration, indenter geometry, specimen preparation, indentation spacing, optical measurement accuracy or compliance with ISO 6507-1 \/ ASTM E92 \/ ASTM E384. Converted hardness values are approximate (ASTM E140).\", \"n\");\n      w.focus();\n      setTimeout(function () { try { w.print(); } catch (e) { \/* ignore *\/ } }, 250);\n    }\n    function toggleSteps() {\n      var open = el.stepsBtn.getAttribute(\"aria-expanded\") !== \"true\";\n      el.stepsBtn.setAttribute(\"aria-expanded\", open ? \"true\" : \"false\");\n      el.stepsBtn.textContent = open ? \"Hide Calculation Steps\" : \"Show Calculation Steps\";\n      setVisible(el.stepsBox, open);\n    }\n    \/* ===================== INPUT BEHAVIOUR ===================== *\/\n    function bindUnit(sel, input, conv) {\n      sel.setAttribute(\"data-prev\", sel.value);\n      sel.addEventListener(\"change\", function () {\n        var prev = sel.getAttribute(\"data-prev\") || sel.value, v = num(input);\n        if (v !== null) { if (isFinite(v)) { input.value = String(Number(conv(v, prev, sel.value).toPrecision(10))); } }\n        sel.setAttribute(\"data-prev\", sel.value);\n        live();\n      });\n    }\n    bindUnit(el.unit, el.force, function (v, a, b) { return kgfToUnit(forceToKgf(v, a), b); });\n    function lenConv(v, a, b) { var mm = lenToMm(v, a); return b === \"um\" ? mm * 1000 : mm; }\n    bindUnit(el.d1u, el.d1, lenConv); bindUnit(el.d2u, el.d2, lenConv); bindUnit(el.du, el.d, lenConv);\n    function applyMode(prefill) {\n      var two = mode() === \"two\";\n      setVisible(el.d1Wrap, two); setVisible(el.d2Wrap, two); setVisible(el.avg, two); setVisible(el.dWrap, !two);\n      if (prefill) {\n        if (!two) {\n          var a = validLen(el.d1, el.d1u), b = validLen(el.d2, el.d2u);\n          if (a !== null) { if (b !== null) { el.du.value = el.d1u.value; el.du.setAttribute(\"data-prev\", el.du.value); el.d.value = String(Number(lenConv((a + b) \/ 2, \"mm\", el.du.value).toPrecision(8))); } }\n          setErr(el.d1, el.d1Err, \"\"); setErr(el.d2, el.d2Err, \"\");\n        } else {\n          if (num(el.d1) === null) { if (num(el.d2) === null) { var dv = num(el.d); if (dv !== null) { if (isFinite(dv)) { el.d1.value = String(dv); el.d2.value = String(dv); el.d1u.value = el.du.value; el.d2u.value = el.du.value; el.d1u.setAttribute(\"data-prev\", el.du.value); el.d2u.setAttribute(\"data-prev\", el.du.value); } } } }\n          setErr(el.d, el.dErr, \"\");\n        }\n      }\n    }\n    var radios = root.querySelectorAll('input[name=\"vhc-mode' + sfx + '\"]');\n    for (var i = 0; i < radios.length; i++) { radios[i].addEventListener(\"change\", function () { applyMode(true); live(); }); }\n    el.force.addEventListener(\"input\", function () { validateForce(); live(); });\n    el.dwell.addEventListener(\"input\", function () { validateDwell(); live(); });\n    el.thr.addEventListener(\"input\", function () { validateThr(); live(); });\n    el.prec.addEventListener(\"change\", live);\n    el.d1.addEventListener(\"input\", function () { validateLen(el.d1, el.d1Err, \"first diagonal d\u2081\"); live(); });\n    el.d2.addEventListener(\"input\", function () { validateLen(el.d2, el.d2Err, \"second diagonal d\u2082\"); live(); });\n    el.d.addEventListener(\"input\", function () { validateLen(el.d, el.dErr, \"average diagonal\"); live(); });\n    el.calc.addEventListener(\"click\", function () { onCalculate(false); });\n    el.copy.addEventListener(\"click\", copyResult);\n    el.csv.addEventListener(\"click\", downloadCsv);\n    el.print.addEventListener(\"click\", printSummary);\n    el.stepsBtn.addEventListener(\"click\", toggleSteps);\n    root.querySelector(\".vhc-form\").addEventListener(\"submit\", function (e) { e.preventDefault(); });\n    root.querySelector(\".vhc-form\").addEventListener(\"keydown\", function (e) {\n      if (e.key === \"Enter\" ? (e.target ? e.target.tagName === \"INPUT\" : false) : false) { e.preventDefault(); onCalculate(false); }\n    });\n    setVisible(el.results, false); setVisible(el.stepsBox, false); setVisible(el.dWrap, false);\n    updateAvg(); updateDiagram();\n  }\n})();\n<\/script>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Vickers Hardness (HV) Calculator is a reliable online tool designed to calculate the Vickers hardness of metals and engineering materials quickly and accurately. By&#8230;<\/p>","protected":false},"author":2,"featured_media":24946,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"pmpro_default_level":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[8647],"tags":[8736,8742,4614,8743],"class_list":["post-24945","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-materials-science-and-properties","tag-hardness-testing","tag-hv-calculator","tag-material-testing","tag-vickers-hardness","pmpro-has-access"],"acf":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.mechstream.com\/wp-content\/uploads\/2026\/10\/Vickers-Hardness-HV-Calculator.png","_links":{"self":[{"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/posts\/24945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/comments?post=24945"}],"version-history":[{"count":1,"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/posts\/24945\/revisions"}],"predecessor-version":[{"id":24947,"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/posts\/24945\/revisions\/24947"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/media\/24946"}],"wp:attachment":[{"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/media?parent=24945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/categories?post=24945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mechstream.com\/ar\/wp-json\/wp\/v2\/tags?post=24945"}],"curies":[{"name":"\u0648\u0648\u0631\u062f\u0628\u0631\u064a\u0633","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}