{"product_id":"margin-calculator","title":"Margin Calculator","description":"\u003cstyle\u003e\n.mc-calculator {\n  --ink: #0f172a;\n  --muted: #475569;\n  --border: #e2e8f0;\n  --surface: #ffffff;\n  --tint: #f8fafc;\n  --primary: #1d4ed8;\n  --accent: #c2410c;\n  --accent-hover: #9a3412;\n  --chart-1: #1e40af;\n  --chart-2: #0d9488;\n  --chart-3: #7c3aed;\n  --chart-4: #be185d;\n  --chart-5: #334155;\n  width: 100%;\n  max-width: 1200px;\n  margin: 0 auto;\n  color: var(--ink);\n  background: var(--surface);\n  border: 1px solid var(--border);\n  border-radius: 8px;\n  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);\n  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n  font-size: 15px;\n  line-height: 1.55;\n  container-name: mc-shell;\n  container-type: inline-size;\n  overflow-wrap: anywhere;\n}\n.mc-calculator,\n.mc-calculator *,\n.mc-calculator *::before,\n.mc-calculator *::after {\n  box-sizing: border-box;\n}\n.mc-calculator * {\n  min-width: 0;\n}\n.mc-calculator [hidden] {\n  display: none !important;\n}\n.mc-calculator h2,\n.mc-calculator h3,\n.mc-calculator h4,\n.mc-calculator p {\n  margin-top: 0;\n}\n.mc-calculator h2 {\n  margin-bottom: 8px;\n  font-size: 24px;\n  line-height: 1.25;\n  font-weight: 700;\n  letter-spacing: -.02em;\n}\n.mc-calculator h3 {\n  margin-bottom: 8px;\n  font-size: 18px;\n  line-height: 1.35;\n  font-weight: 650;\n}\n.mc-calculator h4 {\n  margin-bottom: 6px;\n  font-size: 15px;\n  line-height: 1.4;\n  font-weight: 700;\n}\n.mc-calculator a {\n  color: var(--primary);\n  text-decoration-thickness: 1px;\n  text-underline-offset: 2px;\n}\n.mc-calculator a:hover {\n  text-decoration-thickness: 2px;\n}\n.mc-calculator button,\n.mc-calculator input,\n.mc-calculator select {\n  font: inherit;\n}\n.mc-calculator button,\n.mc-calculator select,\n.mc-calculator input {\n  min-height: 44px;\n}\n.mc-calculator :focus-visible {\n  outline: 3px solid rgba(29, 78, 216, .38);\n  outline-offset: 2px;\n}\n.mc-calculator .mc-header {\n  padding: 24px 24px 16px;\n  border-bottom: 1px solid var(--border);\n}\n.mc-calculator .mc-subtitle {\n  max-width: 760px;\n  margin-bottom: 16px;\n  color: var(--muted);\n}\n.mc-calculator .mc-pills {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 8px;\n}\n.mc-calculator .mc-pill {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  min-height: 32px;\n  padding: 5px 10px;\n  border: 1px solid var(--border);\n  border-radius: 999px;\n  background: var(--tint);\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 600;\n  font-variant-numeric: tabular-nums;\n}\n.mc-calculator .mc-pill strong {\n  color: var(--ink);\n  font-weight: 700;\n}\n.mc-calculator .mc-toolbar {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 8px;\n  align-items: center;\n  padding: 16px 24px;\n  border-bottom: 1px solid var(--border);\n  background: var(--tint);\n}\n.mc-calculator .mc-button {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 10px;\n  min-height: 44px;\n  padding: 11px 18px;\n  border: 1px solid transparent;\n  border-radius: 6px;\n  cursor: pointer;\n  font-weight: 700;\n  line-height: 1.2;\n  white-space: nowrap;\n  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .08s ease;\n}\n.mc-calculator .mc-button:hover {\n  box-shadow: 0 2px 5px rgba(15, 23, 42, .14);\n}\n.mc-calculator .mc-button:active {\n  transform: translateY(1px);\n}\n.mc-calculator .mc-download {\n  background: var(--accent);\n  color: #ffffff;\n}\n.mc-calculator .mc-download:hover,\n.mc-calculator .mc-download:active {\n  background: var(--accent-hover);\n}\n.mc-calculator .mc-reset {\n  border-color: #cbd5e1;\n  background: var(--surface);\n  color: var(--ink);\n}\n.mc-calculator .mc-button svg {\n  width: 18px;\n  height: 18px;\n  flex: 0 0 18px;\n  stroke: currentColor;\n  stroke-width: 2;\n  fill: none;\n}\n.mc-calculator .mc-mode-fieldset {\n  margin: 0;\n  padding: 16px 24px 0;\n  border: 0;\n}\n.mc-calculator .mc-mode-legend {\n  margin-bottom: 8px;\n  padding: 0;\n  font-size: 14px;\n  font-weight: 700;\n}\n.mc-calculator .mc-mode-switch {\n  display: grid;\n  grid-template-columns: repeat(3, minmax(0, 1fr));\n  gap: 8px;\n}\n.mc-calculator .mc-mode-button {\n  min-height: 46px;\n  padding: 9px 12px;\n  border: 1px solid #cbd5e1;\n  border-radius: 6px;\n  background: var(--surface);\n  color: var(--ink);\n  cursor: pointer;\n  font-size: 14px;\n  font-weight: 700;\n  line-height: 1.25;\n}\n.mc-calculator .mc-mode-button[aria-pressed=\"true\"] {\n  border-color: var(--primary);\n  background: #eff6ff;\n  color: #1e3a8a;\n  box-shadow: inset 0 0 0 1px var(--primary);\n}\n.mc-calculator .mc-workspace {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n  gap: 16px;\n  padding: 16px 24px 24px;\n}\n.mc-calculator .mc-card {\n  min-width: 0;\n  padding: 20px;\n  border: 1px solid var(--border);\n  border-radius: 8px;\n  background: var(--surface);\n  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);\n}\n.mc-calculator .mc-card-head {\n  margin-bottom: 16px;\n}\n.mc-calculator .mc-card-head p {\n  margin-bottom: 0;\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n}\n.mc-calculator .mc-panel[hidden] {\n  display: none;\n}\n.mc-calculator .mc-fields {\n  display: grid;\n  grid-template-columns: repeat(2, minmax(0, 1fr));\n  gap: 16px;\n}\n.mc-calculator .mc-field {\n  display: flex;\n  flex-direction: column;\n  align-items: stretch;\n  min-width: 0;\n}\n.mc-calculator .mc-field-wide {\n  grid-column: 1 \/ -1;\n}\n.mc-calculator .mc-label {\n  display: block;\n  margin-bottom: 6px;\n  color: var(--ink);\n  font-size: 14px;\n  font-weight: 600;\n}\n.mc-calculator .mc-input,\n.mc-calculator .mc-select {\n  width: 100%;\n  height: 44px;\n  padding: 9px 12px;\n  border: 1px solid #94a3b8;\n  border-radius: 6px;\n  background: var(--surface);\n  color: var(--ink);\n  font-size: 15px;\n  font-weight: 400;\n  font-variant-numeric: tabular-nums;\n}\n.mc-calculator .mc-input:hover,\n.mc-calculator .mc-select:hover {\n  border-color: #64748b;\n}\n.mc-calculator .mc-input:disabled {\n  border-color: var(--border);\n  background: #f1f5f9;\n  color: #334155;\n  cursor: not-allowed;\n  opacity: 1;\n}\n.mc-calculator .mc-helper {\n  min-height: 40px;\n  margin: 6px 0 0;\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n  line-height: 1.45;\n}\n.mc-calculator .mc-error {\n  min-height: 22px;\n  margin: 10px 0 0;\n  color: #b91c1c;\n  font-size: 13px;\n  font-weight: 600;\n}\n.mc-calculator .mc-result-hero {\n  padding: 16px;\n  border: 1px solid #bfdbfe;\n  border-radius: 8px;\n  background: #eff6ff;\n}\n.mc-calculator .mc-result-label {\n  margin-bottom: 4px;\n  color: #334155;\n  font-size: 13px;\n  font-weight: 700;\n  text-transform: uppercase;\n  letter-spacing: .04em;\n}\n.mc-calculator .mc-primary-result {\n  margin-bottom: 4px;\n  color: #172554;\n  font-size: 30px;\n  line-height: 1.15;\n  font-weight: 700;\n  font-variant-numeric: tabular-nums;\n  overflow-wrap: anywhere;\n}\n.mc-calculator .mc-result-context {\n  margin-bottom: 0;\n  color: #334155;\n  font-size: 13px;\n  font-weight: 500;\n}\n.mc-calculator .mc-result-grid {\n  display: grid;\n  grid-template-columns: repeat(2, minmax(0, 1fr));\n  gap: 12px;\n  margin-top: 12px;\n}\n.mc-calculator .mc-result-item {\n  padding: 12px;\n  border: 1px solid var(--border);\n  border-radius: 6px;\n  background: var(--tint);\n}\n.mc-calculator .mc-result-item span {\n  display: block;\n  margin-bottom: 4px;\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 600;\n}\n.mc-calculator .mc-result-item strong {\n  display: block;\n  color: var(--ink);\n  font-size: 20px;\n  line-height: 1.25;\n  font-weight: 700;\n  font-variant-numeric: tabular-nums;\n  overflow-wrap: anywhere;\n}\n.mc-calculator .mc-result-note {\n  margin: 16px 0 0;\n  padding: 10px 12px;\n  border: 1px solid var(--border);\n  border-radius: 6px;\n  background: var(--tint);\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n}\n.mc-calculator .mc-section {\n  padding: 0 24px 24px;\n}\n.mc-calculator .mc-chart-card {\n  display: block;\n}\n.mc-calculator .mc-chart-intro {\n  margin-bottom: 16px;\n}\n.mc-calculator .mc-chart-intro p {\n  margin-bottom: 0;\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n}\n.mc-calculator .mc-chart-total {\n  margin: 8px 0 16px;\n  color: var(--ink);\n  font-size: 13px;\n  font-weight: 700;\n  font-variant-numeric: tabular-nums;\n}\n.mc-calculator .mc-chart-cluster {\n  display: grid;\n  grid-template-columns: minmax(0, 320px) minmax(0, max-content);\n  justify-content: center;\n  align-items: center;\n  gap: 24px;\n  width: 100%;\n  max-width: 760px;\n  margin: 0 auto;\n}\n.mc-calculator .mc-plot {\n  position: relative;\n  width: min(100%, 320px);\n  aspect-ratio: 1 \/ 1;\n  margin: 0 auto;\n}\n.mc-calculator .mc-chart-svg {\n  display: block;\n  width: 100%;\n  height: 100%;\n  overflow: visible;\n}\n.mc-calculator .mc-chart-empty {\n  display: grid;\n  min-height: 112px;\n  place-items: center;\n  padding: 16px;\n  border: 1px dashed #94a3b8;\n  border-radius: 6px;\n  background: var(--tint);\n  color: var(--muted);\n  text-align: center;\n  font-size: 13px;\n  font-weight: 600;\n}\n.mc-calculator .mc-chart-empty[hidden],\n.mc-calculator .mc-chart-svg[hidden] {\n  display: none;\n}\n.mc-calculator .mc-chart-card.mc-chart-is-empty .mc-chart-cluster {\n  grid-template-columns: minmax(0, 520px);\n  max-width: 520px;\n}\n.mc-calculator .mc-chart-card.mc-chart-is-empty .mc-plot {\n  width: 100%;\n  max-width: 520px;\n  aspect-ratio: auto;\n}\n.mc-calculator .mc-donut-track {\n  fill: none;\n  stroke: #e2e8f0;\n  stroke-width: 36;\n}\n.mc-calculator .mc-donut-segment {\n  fill: none;\n  stroke-width: 36;\n  stroke-linecap: butt;\n}\n.mc-calculator .mc-chart-center-caption {\n  fill: var(--muted);\n  font-size: 13px;\n  font-weight: 600;\n  text-anchor: middle;\n}\n.mc-calculator .mc-chart-center-value {\n  fill: var(--ink);\n  font-size: 22px;\n  font-weight: 700;\n  text-anchor: middle;\n  font-variant-numeric: tabular-nums;\n}\n.mc-calculator .mc-legend {\n  display: grid;\n  gap: 10px;\n  align-content: center;\n  min-width: 220px;\n  max-width: 360px;\n}\n.mc-calculator .mc-legend-row {\n  display: grid;\n  grid-template-columns: 14px minmax(80px, max-content) max-content max-content;\n  align-items: center;\n  column-gap: 10px;\n  row-gap: 4px;\n  padding: 4px 0;\n  color: var(--ink);\n  font-size: 13px;\n  font-weight: 600;\n  font-variant-numeric: tabular-nums;\n}\n.mc-calculator .mc-swatch {\n  width: 12px;\n  height: 12px;\n  border-radius: 3px;\n}\n.mc-calculator .mc-legend-amount,\n.mc-calculator .mc-legend-percent {\n  white-space: nowrap;\n}\n.mc-calculator .mc-legend-percent {\n  color: var(--muted);\n}\n.mc-calculator .mc-chart-caption {\n  margin: 16px auto 0;\n  max-width: 760px;\n  padding: 10px 12px;\n  border: 1px solid var(--border);\n  border-radius: 6px;\n  background: var(--tint);\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n}\n.mc-calculator .mc-chart-card.mc-safe-stack .mc-chart-cluster {\n  grid-template-columns: minmax(0, 320px);\n  gap: 16px;\n}\n.mc-calculator .mc-chart-card.mc-safe-stack .mc-legend {\n  width: min(100%, 420px);\n  min-width: 0;\n  margin: 0 auto;\n}\n.mc-calculator .mc-chart-card.mc-safe-stack .mc-chart-caption {\n  margin-top: 24px;\n}\n.mc-calculator .mc-sr-only {\n  position: absolute !important;\n  width: 1px !important;\n  height: 1px !important;\n  padding: 0 !important;\n  margin: -1px !important;\n  overflow: hidden !important;\n  clip: rect(0, 0, 0, 0) !important;\n  white-space: nowrap !important;\n  border: 0 !important;\n}\n.mc-calculator .mc-table-card .mc-card-head {\n  margin-bottom: 12px;\n}\n.mc-calculator .mc-table-wrap {\n  width: 100%;\n  overflow-x: auto;\n  overflow-y: visible;\n  border: 1px solid var(--border);\n  border-radius: 6px;\n}\n.mc-calculator .mc-table {\n  width: 100%;\n  min-width: 560px;\n  border-collapse: collapse;\n  font-variant-numeric: tabular-nums;\n}\n.mc-calculator .mc-table th,\n.mc-calculator .mc-table td {\n  padding: 10px 12px;\n  border-bottom: 1px solid var(--border);\n  text-align: left;\n  vertical-align: top;\n  font-size: 13px;\n}\n.mc-calculator .mc-table th {\n  background: #eaf0f8;\n  color: var(--ink);\n  font-weight: 700;\n}\n.mc-calculator .mc-table td {\n  background: var(--surface);\n  color: var(--ink);\n  font-weight: 500;\n}\n.mc-calculator .mc-table tr:last-child td {\n  border-bottom: 0;\n}\n.mc-calculator .mc-table .mc-number {\n  text-align: right;\n  white-space: nowrap;\n}\n.mc-calculator .mc-table-note {\n  margin: 16px 0 0;\n  padding: 10px 12px;\n  border: 1px solid var(--border);\n  border-radius: 6px;\n  background: var(--tint);\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n}\n.mc-calculator .mc-table-card.mc-safe-table-stack .mc-table-note {\n  margin-top: 24px;\n}\n.mc-calculator .mc-education {\n  padding: 24px;\n  border-top: 1px solid var(--border);\n  background: var(--tint);\n}\n.mc-calculator .mc-education-inner {\n  max-width: 900px;\n}\n.mc-calculator .mc-education h2 {\n  margin-top: 0;\n}\n.mc-calculator .mc-education h3 {\n  margin-top: 24px;\n}\n.mc-calculator .mc-education p,\n.mc-calculator .mc-education li {\n  color: #334155;\n}\n.mc-calculator .mc-education p {\n  margin-bottom: 12px;\n}\n.mc-calculator .mc-education ul {\n  margin: 0 0 16px;\n  padding-left: 22px;\n}\n.mc-calculator .mc-formula {\n  margin: 12px 0;\n  padding: 12px;\n  border-left: 4px solid var(--primary);\n  border-radius: 0 6px 6px 0;\n  background: var(--surface);\n  color: var(--ink);\n  font-weight: 650;\n  font-variant-numeric: tabular-nums;\n}\n@container mc-shell (max-width: 639px) {\n  .mc-calculator .mc-header,\n  .mc-calculator .mc-toolbar,\n  .mc-calculator .mc-mode-fieldset,\n  .mc-calculator .mc-workspace,\n  .mc-calculator .mc-section,\n  .mc-calculator .mc-education {\n    padding-left: 16px;\n    padding-right: 16px;\n  }\n  .mc-calculator .mc-mode-switch {\n    grid-template-columns: 1fr;\n  }\n  .mc-calculator .mc-fields,\n  .mc-calculator .mc-result-grid {\n    grid-template-columns: minmax(0, 1fr);\n  }\n  .mc-calculator .mc-chart-cluster {\n    grid-template-columns: minmax(0, 320px);\n    gap: 16px;\n  }\n  .mc-calculator .mc-legend {\n    width: min(100%, 420px);\n    min-width: 0;\n    margin: 0 auto;\n  }\n  .mc-calculator .mc-legend-row {\n    grid-template-columns: 14px minmax(72px, max-content) max-content max-content;\n    column-gap: 8px;\n  }\n  .mc-calculator .mc-chart-caption,\n  .mc-calculator .mc-table-note {\n    margin-top: 16px;\n  }\n}\n@container mc-shell (max-width: 359px) {\n  .mc-calculator .mc-toolbar .mc-button {\n    width: 100%;\n  }\n  .mc-calculator .mc-card {\n    padding: 16px;\n  }\n  .mc-calculator .mc-legend-row {\n    grid-template-columns: 14px minmax(0, 1fr) max-content;\n  }\n  .mc-calculator .mc-legend-percent {\n    grid-column: 2 \/ -1;\n    padding-left: 0;\n  }\n}\n@container mc-shell (min-width: 900px) {\n  .mc-calculator .mc-workspace {\n    grid-template-columns: minmax(0, 1.04fr) minmax(340px, .96fr);\n    align-items: start;\n  }\n}\n@media (max-width: 639px) {\n  .mc-calculator .mc-header,\n  .mc-calculator .mc-toolbar,\n  .mc-calculator .mc-mode-fieldset,\n  .mc-calculator .mc-workspace,\n  .mc-calculator .mc-section,\n  .mc-calculator .mc-education {\n    padding-left: 16px;\n    padding-right: 16px;\n  }\n}\n\u003c\/style\u003e\n\u003cdiv class=\"mc-calculator\" data-calculator-root\u003e\n  \u003cheader class=\"mc-header\"\u003e\n    \u003ch2\u003eMargin Calculator\u003c\/h2\u003e\n    \u003cp class=\"mc-subtitle\"\u003eCalculate product profit margin, stock-purchase margin requirements, or foreign-exchange margin from one compact financial workspace.\u003c\/p\u003e\n    \u003cdiv class=\"mc-pills\" aria-label=\"Current calculation summary\"\u003e\n      \u003cspan class=\"mc-pill\"\u003eMode: \u003cstrong data-pill=\"mode\"\u003eProfit margin\u003c\/strong\u003e\u003c\/span\u003e\n      \u003cspan class=\"mc-pill\"\u003ePrimary: \u003cstrong data-pill=\"primary\"\u003e25.00%\u003c\/strong\u003e\u003c\/span\u003e\n      \u003cspan class=\"mc-pill\"\u003eStatus: \u003cstrong data-pill=\"status\"\u003eReady\u003c\/strong\u003e\u003c\/span\u003e\n    \u003c\/div\u003e\n  \u003c\/header\u003e\n\n  \u003cdiv class=\"mc-toolbar\" aria-label=\"Calculator actions\"\u003e\n    \u003cbutton class=\"mc-button mc-download\" type=\"button\" data-action=\"download\"\u003e\n      \u003csvg viewbox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"\u003e\u003cpath d=\"M12 3v12m0 0 5-5m-5 5-5-5M5 21h14\"\u003e\u003c\/path\u003e\u003c\/svg\u003e\n      \u003cspan\u003eDownload Excel\u003c\/span\u003e\n    \u003c\/button\u003e\n    \u003cbutton class=\"mc-button mc-reset\" type=\"button\" data-action=\"reset\"\u003e\n      \u003csvg viewbox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"\u003e\u003cpath d=\"M4 4v6h6M20 20v-6h-6M5.5 15a7 7 0 0 0 11.9 2.4L20 14M4 10l2.6-3.4A7 7 0 0 1 18.5 9\"\u003e\u003c\/path\u003e\u003c\/svg\u003e\n      \u003cspan\u003eReset\u003c\/span\u003e\n    \u003c\/button\u003e\n  \u003c\/div\u003e\n\n  \u003cfieldset class=\"mc-mode-fieldset\"\u003e\n    \u003clegend class=\"mc-mode-legend\"\u003eCalculation type\u003c\/legend\u003e\n    \u003cdiv class=\"mc-mode-switch\" data-role=\"mode-switch\"\u003e\n      \u003cbutton class=\"mc-mode-button\" type=\"button\" data-mode=\"profit\" aria-pressed=\"true\"\u003eProfit margin\u003c\/button\u003e\n      \u003cbutton class=\"mc-mode-button\" type=\"button\" data-mode=\"stock\" aria-pressed=\"false\"\u003eStock trading margin\u003c\/button\u003e\n      \u003cbutton class=\"mc-mode-button\" type=\"button\" data-mode=\"forex\" aria-pressed=\"false\"\u003eCurrency exchange margin\u003c\/button\u003e\n    \u003c\/div\u003e\n  \u003c\/fieldset\u003e\n\n  \u003cdiv class=\"mc-workspace\"\u003e\n    \u003csection class=\"mc-card mc-input-card\" aria-labelledby=\"mc-inputs-title\"\u003e\n      \u003cdiv class=\"mc-card-head\"\u003e\n        \u003ch3 id=\"mc-inputs-title\"\u003eInputs\u003c\/h3\u003e\n        \u003cp data-role=\"input-intro\"\u003eChoose the two profit values you know. The remaining values update automatically.\u003c\/p\u003e\n      \u003c\/div\u003e\n\n      \u003cdiv class=\"mc-panel\" data-panel=\"profit\"\u003e\n        \u003cdiv class=\"mc-fields\"\u003e\n          \u003cdiv class=\"mc-field mc-field-wide\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-profit-known\"\u003eKnown values\u003c\/label\u003e\n            \u003cselect class=\"mc-select\" id=\"mc-profit-known\" data-field=\"profitKnown\"\u003e\n              \u003coption value=\"costRevenue\"\u003eCost and revenue\u003c\/option\u003e\n              \u003coption value=\"costMargin\"\u003eCost and margin\u003c\/option\u003e\n              \u003coption value=\"costProfit\"\u003eCost and profit\u003c\/option\u003e\n              \u003coption value=\"revenueMargin\"\u003eRevenue and margin\u003c\/option\u003e\n              \u003coption value=\"revenueProfit\"\u003eRevenue and profit\u003c\/option\u003e\n              \u003coption value=\"marginProfit\"\u003eMargin and profit\u003c\/option\u003e\n            \u003c\/select\u003e\n            \u003cp class=\"mc-helper\"\u003eSelect the pair you can provide; derived fields remain visible but read-only.\u003c\/p\u003e\n          \u003c\/div\u003e\n          \u003cdiv class=\"mc-field\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-profit-cost\"\u003eCost\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-profit-cost\" data-field=\"profitCost\" data-format=\"currency\" inputmode=\"decimal\" type=\"text\" value=\"$120.00\"\u003e\n            \u003cp class=\"mc-helper\"\u003eDirect cost of the item, service, or transaction.\u003c\/p\u003e\n          \u003c\/div\u003e\n          \u003cdiv class=\"mc-field\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-profit-revenue\"\u003eRevenue\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-profit-revenue\" data-field=\"profitRevenue\" data-format=\"currency\" inputmode=\"decimal\" type=\"text\" value=\"$160.00\"\u003e\n            \u003cp class=\"mc-helper\"\u003eSelling price or sales revenue generated.\u003c\/p\u003e\n          \u003c\/div\u003e\n          \u003cdiv class=\"mc-field\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-profit-margin\"\u003eMargin\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-profit-margin\" data-field=\"profitMargin\" data-format=\"percent\" inputmode=\"decimal\" type=\"text\" value=\"25.00%\" disabled\u003e\n            \u003cp class=\"mc-helper\"\u003eProfit as a percentage of revenue.\u003c\/p\u003e\n          \u003c\/div\u003e\n          \u003cdiv class=\"mc-field\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-profit-profit\"\u003eProfit\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-profit-profit\" data-field=\"profitProfit\" data-format=\"currency\" inputmode=\"decimal\" type=\"text\" value=\"$40.00\" disabled\u003e\n            \u003cp class=\"mc-helper\"\u003eRevenue remaining after subtracting cost.\u003c\/p\u003e\n          \u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cp class=\"mc-error\" data-error=\"profit\" role=\"alert\"\u003e\u003c\/p\u003e\n      \u003c\/div\u003e\n\n      \u003cdiv class=\"mc-panel\" data-panel=\"stock\" hidden\u003e\n        \u003cdiv class=\"mc-fields\"\u003e\n          \u003cdiv class=\"mc-field\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-stock-price\"\u003eStock price\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-stock-price\" data-field=\"stockPrice\" data-format=\"currency\" inputmode=\"decimal\" type=\"text\" value=\"$61.00\"\u003e\n            \u003cp class=\"mc-helper\"\u003eCurrent or planned purchase price per share.\u003c\/p\u003e\n          \u003c\/div\u003e\n          \u003cdiv class=\"mc-field\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-stock-shares\"\u003eNumber of shares\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-stock-shares\" data-field=\"stockShares\" data-format=\"number\" inputmode=\"decimal\" type=\"text\" value=\"30\"\u003e\n            \u003cp class=\"mc-helper\"\u003eTotal shares included in the margin purchase.\u003c\/p\u003e\n          \u003c\/div\u003e\n          \u003cdiv class=\"mc-field mc-field-wide\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-stock-requirement\"\u003eMargin requirement\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-stock-requirement\" data-field=\"stockRequirement\" data-format=\"percent\" inputmode=\"decimal\" type=\"text\" value=\"30.00%\"\u003e\n            \u003cp class=\"mc-helper\"\u003ePercentage of the position value that must be funded with account equity.\u003c\/p\u003e\n          \u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cp class=\"mc-error\" data-error=\"stock\" role=\"alert\"\u003e\u003c\/p\u003e\n      \u003c\/div\u003e\n\n      \u003cdiv class=\"mc-panel\" data-panel=\"forex\" hidden\u003e\n        \u003cdiv class=\"mc-fields\"\u003e\n          \u003cdiv class=\"mc-field\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-forex-rate\"\u003eExchange rate\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-forex-rate\" data-field=\"forexRate\" data-format=\"number\" inputmode=\"decimal\" type=\"text\" value=\"1.3\"\u003e\n            \u003cp class=\"mc-helper\"\u003eHome-currency value of one unit of the purchased currency.\u003c\/p\u003e\n          \u003c\/div\u003e\n          \u003cdiv class=\"mc-field\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-forex-ratio\"\u003eMargin ratio\u003c\/label\u003e\n            \u003cselect class=\"mc-select\" id=\"mc-forex-ratio\" data-field=\"forexRatio\"\u003e\n              \u003coption value=\"1\"\u003e1:1\u003c\/option\u003e\n              \u003coption value=\"5\"\u003e5:1\u003c\/option\u003e\n              \u003coption value=\"10\"\u003e10:1\u003c\/option\u003e\n              \u003coption value=\"20\" selected\u003e20:1\u003c\/option\u003e\n              \u003coption value=\"25\"\u003e25:1\u003c\/option\u003e\n              \u003coption value=\"30\"\u003e30:1\u003c\/option\u003e\n              \u003coption value=\"40\"\u003e40:1\u003c\/option\u003e\n              \u003coption value=\"50\"\u003e50:1\u003c\/option\u003e\n            \u003c\/select\u003e\n            \u003cp class=\"mc-helper\"\u003eLeverage multiple applied to the full currency exposure.\u003c\/p\u003e\n          \u003c\/div\u003e\n          \u003cdiv class=\"mc-field mc-field-wide\"\u003e\n            \u003clabel class=\"mc-label\" for=\"mc-forex-units\"\u003eUnits\u003c\/label\u003e\n            \u003cinput class=\"mc-input\" id=\"mc-forex-units\" data-field=\"forexUnits\" data-format=\"number\" inputmode=\"decimal\" type=\"text\" value=\"100\"\u003e\n            \u003cp class=\"mc-helper\"\u003eQuantity of foreign-currency units to purchase.\u003c\/p\u003e\n          \u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cp class=\"mc-error\" data-error=\"forex\" role=\"alert\"\u003e\u003c\/p\u003e\n      \u003c\/div\u003e\n    \u003c\/section\u003e\n\n    \u003csection class=\"mc-card mc-results-card\" aria-labelledby=\"mc-results-title\"\u003e\n      \u003cdiv class=\"mc-card-head\"\u003e\n        \u003ch3 id=\"mc-results-title\"\u003eLive results\u003c\/h3\u003e\n        \u003cp\u003eResults, chart, table, and workbook all use the same current-state calculation model.\u003c\/p\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"mc-result-hero\"\u003e\n        \u003cdiv class=\"mc-result-label\" data-result=\"primaryLabel\"\u003eProfit margin\u003c\/div\u003e\n        \u003cdiv class=\"mc-primary-result\" data-result=\"primaryValue\"\u003e25.00%\u003c\/div\u003e\n        \u003cp class=\"mc-result-context\" data-result=\"primaryContext\"\u003eYou retain $0.25 of profit for each $1.00 of revenue.\u003c\/p\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"mc-result-grid\" data-role=\"result-grid\"\u003e\u003c\/div\u003e\n      \u003cp class=\"mc-result-note\" data-role=\"result-note\"\u003eMargin and markup use different denominators: revenue for margin and cost for markup.\u003c\/p\u003e\n      \u003cdiv class=\"mc-sr-only\" aria-live=\"polite\" aria-atomic=\"true\" data-role=\"live-summary\"\u003e\u003c\/div\u003e\n    \u003c\/section\u003e\n  \u003c\/div\u003e\n\n  \u003csection class=\"mc-section\"\u003e\n    \u003cdiv class=\"mc-card mc-chart-card\" data-chart-card\u003e\n      \u003cdiv class=\"mc-chart-intro\"\u003e\n        \u003ch3 data-chart=\"title\"\u003eRevenue composition\u003c\/h3\u003e\n        \u003cp data-chart=\"intro\"\u003eSee how the selling price is divided between cost and profit.\u003c\/p\u003e\n        \u003cp class=\"mc-chart-total\" data-chart=\"total-line\"\u003eRevenue: $160.00\u003c\/p\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"mc-chart-cluster\" data-chart=\"cluster\"\u003e\n        \u003cdiv class=\"mc-plot\" data-chart=\"plot\"\u003e\n          \u003csvg class=\"mc-chart-svg\" data-chart=\"svg\" viewbox=\"0 0 320 320\" role=\"img\" aria-labelledby=\"mc-chart-access-title mc-chart-access-description\"\u003e\n            \u003ctitle id=\"mc-chart-access-title\"\u003eMargin breakdown chart\u003c\/title\u003e\n            \u003cdesc id=\"mc-chart-access-description\"\u003eCost is 75 percent and profit is 25 percent of revenue.\u003c\/desc\u003e\n            \u003cg data-chart=\"segments\"\u003e\u003c\/g\u003e\n            \u003ctext class=\"mc-chart-center-caption\" x=\"160\" y=\"148\" data-chart=\"center-caption\"\u003eRevenue\u003c\/text\u003e\n            \u003ctext class=\"mc-chart-center-value\" x=\"160\" y=\"177\" data-chart=\"center-value\"\u003e$160.00\u003c\/text\u003e\n          \u003c\/svg\u003e\n          \u003cdiv class=\"mc-chart-empty\" data-chart=\"empty\" hidden\u003eEnter values above to see the breakdown.\u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"mc-legend\" data-chart=\"legend\" aria-label=\"Chart legend\"\u003e\u003c\/div\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"mc-sr-only\" data-chart=\"summary\"\u003e\u003c\/div\u003e\n      \u003cp class=\"mc-chart-caption\" data-chart=\"caption\"\u003eCost represents 75.00% of revenue, leaving a 25.00% profit margin.\u003c\/p\u003e\n    \u003c\/div\u003e\n  \u003c\/section\u003e\n\n  \u003csection class=\"mc-section\"\u003e\n    \u003cdiv class=\"mc-card mc-table-card\" data-table-card\u003e\n      \u003cdiv class=\"mc-card-head\"\u003e\n        \u003ch3 data-table=\"title\"\u003eCalculation details\u003c\/h3\u003e\n        \u003cp data-table=\"intro\"\u003eA transparent view of the inputs, formulas, and resulting values.\u003c\/p\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"mc-table-wrap\" data-table=\"wrap\"\u003e\n        \u003ctable class=\"mc-table\"\u003e\n          \u003cthead\u003e\n            \u003ctr\u003e\n              \u003cth scope=\"col\"\u003eMetric\u003c\/th\u003e\n              \u003cth scope=\"col\"\u003eFormula or basis\u003c\/th\u003e\n              \u003cth scope=\"col\" class=\"mc-number\"\u003eValue\u003c\/th\u003e\n            \u003c\/tr\u003e\n          \u003c\/thead\u003e\n          \u003ctbody data-table=\"body\"\u003e\u003c\/tbody\u003e\n        \u003c\/table\u003e\n      \u003c\/div\u003e\n      \u003cp class=\"mc-table-note\" data-table=\"note\"\u003ePercentages are rounded for display; calculations retain full precision.\u003c\/p\u003e\n    \u003c\/div\u003e\n  \u003c\/section\u003e\n\n  \u003csection class=\"mc-education\"\u003e\n    \u003cdiv class=\"mc-education-inner\"\u003e\n      \u003ch2\u003eHow to use the margin calculator\u003c\/h2\u003e\n      \u003cp\u003eThis tool covers three common meanings of “margin.” Profit margin describes how much of a selling price remains after cost. Stock trading margin estimates the account equity required to open a securities position. Currency exchange margin estimates the deposit needed for a leveraged foreign-exchange position. Select the calculation type at the top; the live results, visual breakdown, details table, and Excel workbook then follow that mode.\u003c\/p\u003e\n\n      \u003ch3\u003eProfit margin inputs and outputs\u003c\/h3\u003e\n      \u003cp\u003eStart with the \u003cstrong\u003eKnown values\u003c\/strong\u003e selector. The calculator can solve from any practical pair of cost, revenue, margin, and profit. Choose \u003cstrong\u003eCost and revenue\u003c\/strong\u003e when you know purchase or production cost and selling price. Choose a pair containing \u003cstrong\u003emargin\u003c\/strong\u003e when you have a target percentage and need to solve for price, cost, or profit. Derived fields remain visible and read-only so that the complete pricing relationship is easy to audit.\u003c\/p\u003e\n      \u003cul\u003e\n        \u003cli\u003e\n\u003cstrong\u003eCost\u003c\/strong\u003e is the direct amount spent to obtain or deliver the item or service. Use the same unit and period as revenue. Higher cost reduces profit, margin, and markup when revenue is unchanged.\u003c\/li\u003e\n        \u003cli\u003e\n\u003cstrong\u003eRevenue\u003c\/strong\u003e is the selling price or sales income before subtracting cost. Higher revenue increases profit and usually increases both margin and markup when cost is unchanged.\u003c\/li\u003e\n        \u003cli\u003e\n\u003cstrong\u003eMargin\u003c\/strong\u003e is profit divided by revenue. A zero margin means revenue exactly equals cost. A negative margin indicates a loss. A margin approaching 100% implies cost approaching zero.\u003c\/li\u003e\n        \u003cli\u003e\n\u003cstrong\u003eProfit\u003c\/strong\u003e is revenue minus cost. A negative profit is a loss. Profit is an amount, while margin and markup are percentages.\u003c\/li\u003e\n      \u003c\/ul\u003e\n      \u003cdiv class=\"mc-formula\"\u003eProfit = Revenue − Cost\u003cbr\u003eMargin = Profit ÷ Revenue\u003cbr\u003eMarkup = Profit ÷ Cost\u003c\/div\u003e\n      \u003cp\u003eThe primary result is the margin percentage. The supporting cards show profit, revenue or cost, and markup. The donut chart uses revenue as the total and divides it into cost and positive profit. If the inputs imply a loss, the calculator intentionally replaces the donut with an explanatory empty state because a loss is not a valid positive share of revenue. The details table shows every formula explicitly.\u003c\/p\u003e\n\n      \u003ch3\u003eStock trading margin inputs and outputs\u003c\/h3\u003e\n      \u003cp\u003eEnter the \u003cstrong\u003estock price\u003c\/strong\u003e, \u003cstrong\u003enumber of shares\u003c\/strong\u003e, and the broker’s \u003cstrong\u003emargin requirement\u003c\/strong\u003e. Stock price is the per-share market or order price. Shares may be whole or fractional where the broker permits fractional trading. The requirement is the percentage of the total position that must be funded with account equity. A higher price, larger share count, or higher requirement increases the amount required.\u003c\/p\u003e\n      \u003cdiv class=\"mc-formula\"\u003ePosition value = Stock price × Shares\u003cbr\u003eAmount required = Position value × Margin requirement\u003c\/div\u003e\n      \u003cp\u003eThe primary result is the required account equity. The financed portion is the remainder of the position value after subtracting that equity. The chart compares your required equity with the financed portion. This is an opening-position estimate, not a maintenance-margin or margin-call model. Broker house rules can be stricter than regulatory minimums, and requirements can change with security type and volatility. Review the \u003ca href=\"https:\/\/www.finra.org\/investors\/investing\/investment-products\/stocks\/day-trading\/margin-accounts\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eFINRA overview of margin accounts\u003c\/a\u003e, the \u003ca href=\"https:\/\/www.federalreserve.gov\/supervisionreg\/regtcg.htm\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eFederal Reserve’s Regulation T resources\u003c\/a\u003e, and the \u003ca href=\"https:\/\/www.sec.gov\/investor\/pubs\/margin.htm\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eSEC investor guidance on margin\u003c\/a\u003e before using borrowed funds.\u003c\/p\u003e\n\n      \u003ch3\u003eCurrency exchange margin inputs and outputs\u003c\/h3\u003e\n      \u003cp\u003eFor foreign exchange, enter the \u003cstrong\u003eexchange rate\u003c\/strong\u003e as the home-currency value of one purchased currency unit. Select the \u003cstrong\u003emargin ratio\u003c\/strong\u003e, such as 20:1, and enter the number of \u003cstrong\u003eunits\u003c\/strong\u003e. The full exposure equals exchange rate multiplied by units. Required margin equals that exposure divided by the leverage ratio. For example, 20:1 leverage corresponds to a 5% margin rate.\u003c\/p\u003e\n      \u003cdiv class=\"mc-formula\"\u003eExposure = Exchange rate × Units\u003cbr\u003eRequired margin = Exposure ÷ Leverage ratio\u003cbr\u003eMargin rate = 1 ÷ Leverage ratio\u003c\/div\u003e\n      \u003cp\u003eThe primary result is the home-currency amount set aside as margin. The supporting values show full exposure, leverage, and the implied margin rate. The chart separates required margin from leveraged exposure. Increasing leverage reduces the initial deposit but magnifies sensitivity to price changes; it does not reduce the economic size of the position. The \u003ca href=\"https:\/\/www.cftc.gov\/LearnAndProtect\/AdvisoriesAndArticles\/fraudadv_forex.html\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eCFTC’s retail forex advisory\u003c\/a\u003e explains important leverage and fraud risks.\u003c\/p\u003e\n\n      \u003ch3\u003eInterpreting results and avoiding common mistakes\u003c\/h3\u003e\n      \u003cp\u003eKeep units consistent. Do not mix a monthly cost with annual revenue, a per-unit cost with total sales, or a quote in one currency with an exposure in another. Margin and markup are not interchangeable: a 25% margin on revenue equals a 33.33% markup on cost. In trading modes, the required amount is not the maximum possible loss, a fee, or a recommendation. Market moves, financing costs, commissions, spreads, maintenance rules, and liquidation policies are outside this simplified estimate.\u003c\/p\u003e\n      \u003cp\u003eUse the Reset button to clear all editable assumptions and return the visual to a neutral state. Use Download Excel after changing inputs to create a current-state workbook with Summary, Inputs, Breakdown, Details, and Notes sheets. The workbook stores percentages as numeric fractions and preserves unrounded values where appropriate. This calculator is educational and does not provide individualized investment, tax, legal, or financial advice.\u003c\/p\u003e\n    \u003c\/div\u003e\n  \u003c\/section\u003e\n\u003c\/div\u003e","brand":"FinancialModelsLab","offers":[{"title":"Default Title","offer_id":49909483077875,"sku":"margin-calculator","price":0.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0522\/6191\/2762\/files\/margin-calculator.webp?v=1783935419","url":"https:\/\/financialmodelslab.com\/products\/margin-calculator","provider":"Financial Models Lab","version":"1.0","type":"link"}