{"product_id":"lifo-for-inventories","title":"LIFO Calculator for Inventory","description":"\u003cstyle\u003e\n.lfi-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  font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n  font-size: 15px;\n  line-height: 1.55;\n  container-type: inline-size;\n  container-name: lfi-layout;\n}\n.lfi-calculator,\n.lfi-calculator *,\n.lfi-calculator *::before,\n.lfi-calculator *::after {\n  box-sizing: border-box;\n}\n.lfi-calculator * {\n  min-width: 0;\n}\n.lfi-calculator h2,\n.lfi-calculator h3,\n.lfi-calculator p {\n  margin-top: 0;\n}\n.lfi-calculator h2 {\n  margin-bottom: 8px;\n  font-size: 24px;\n  line-height: 1.25;\n  font-weight: 700;\n  letter-spacing: -0.015em;\n}\n.lfi-calculator h3 {\n  margin-bottom: 12px;\n  font-size: 18px;\n  line-height: 1.35;\n  font-weight: 650;\n}\n.lfi-calculator a {\n  color: var(--primary);\n  text-decoration-thickness: 1px;\n  text-underline-offset: 2px;\n}\n.lfi-calculator a:hover {\n  text-decoration-thickness: 2px;\n}\n.lfi-calculator .lfi-header {\n  padding: 24px;\n  border: 1px solid var(--border);\n  border-radius: 8px 8px 0 0;\n  background: var(--surface);\n  box-shadow: 0 1px 2px rgba(15,23,42,.06);\n}\n.lfi-calculator .lfi-header-copy {\n  max-width: 780px;\n  margin-bottom: 16px;\n  color: var(--muted);\n}\n.lfi-calculator .lfi-summary-pills {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 8px;\n}\n.lfi-calculator .lfi-pill {\n  display: inline-flex;\n  align-items: center;\n  min-height: 32px;\n  padding: 4px 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.lfi-calculator .lfi-toolbar {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  gap: 8px;\n  padding: 16px 24px;\n  border-right: 1px solid var(--border);\n  border-bottom: 1px solid var(--border);\n  border-left: 1px solid var(--border);\n  background: var(--tint);\n}\n.lfi-calculator .lfi-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  font: inherit;\n  font-size: 15px;\n  font-weight: 650;\n  line-height: 1.2;\n  cursor: pointer;\n  white-space: nowrap;\n  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;\n}\n.lfi-calculator .lfi-button:hover {\n  box-shadow: 0 2px 5px rgba(15,23,42,.12);\n}\n.lfi-calculator .lfi-button:active {\n  transform: translateY(1px);\n}\n.lfi-calculator .lfi-button:focus-visible,\n.lfi-calculator .lfi-input:focus-visible,\n.lfi-calculator .lfi-select:focus-visible,\n.lfi-calculator .lfi-icon-button:focus-visible,\n.lfi-calculator .lfi-details summary:focus-visible {\n  outline: 3px solid rgba(29,78,216,.35);\n  outline-offset: 2px;\n}\n.lfi-calculator .lfi-download {\n  background: var(--accent);\n  color: #ffffff;\n}\n.lfi-calculator .lfi-download:hover {\n  background: var(--accent-hover);\n}\n.lfi-calculator .lfi-secondary {\n  border-color: #cbd5e1;\n  background: var(--surface);\n  color: var(--ink);\n}\n.lfi-calculator .lfi-secondary:hover {\n  border-color: #94a3b8;\n  background: #f1f5f9;\n}\n.lfi-calculator .lfi-button-icon {\n  width: 18px;\n  height: 18px;\n  flex: 0 0 18px;\n}\n.lfi-calculator .lfi-workspace {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n  gap: 16px;\n  padding: 16px 0;\n}\n.lfi-calculator .lfi-card,\n.lfi-calculator .lfi-section {\n  border: 1px solid var(--border);\n  border-radius: 8px;\n  background: var(--surface);\n  box-shadow: 0 1px 2px rgba(15,23,42,.06);\n}\n.lfi-calculator .lfi-card {\n  padding: 20px;\n}\n.lfi-calculator .lfi-card-heading {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: baseline;\n  gap: 8px 12px;\n  margin-bottom: 16px;\n}\n.lfi-calculator .lfi-card-heading h3 {\n  margin-bottom: 0;\n}\n.lfi-calculator .lfi-card-subtitle {\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n}\n.lfi-calculator .lfi-batches {\n  display: grid;\n  gap: 12px;\n}\n.lfi-calculator .lfi-batch-row {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n  gap: 12px;\n  padding: 16px;\n  border: 1px solid var(--border);\n  border-radius: 8px;\n  background: var(--tint);\n}\n.lfi-calculator .lfi-batch-title-row {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n}\n.lfi-calculator .lfi-batch-title {\n  flex: 1 1 auto;\n  margin: 0;\n  color: var(--ink);\n  font-size: 14px;\n  font-weight: 700;\n}\n.lfi-calculator .lfi-icon-button {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  width: 38px;\n  height: 38px;\n  padding: 0;\n  border: 1px solid #cbd5e1;\n  border-radius: 6px;\n  background: var(--surface);\n  color: #991b1b;\n  cursor: pointer;\n}\n.lfi-calculator .lfi-icon-button:hover {\n  border-color: #fca5a5;\n  background: #fef2f2;\n}\n.lfi-calculator .lfi-fields-grid {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n  gap: 12px;\n}\n.lfi-calculator .lfi-field {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n}\n.lfi-calculator .lfi-label {\n  color: var(--ink);\n  font-size: 14px;\n  font-weight: 600;\n}\n.lfi-calculator .lfi-input,\n.lfi-calculator .lfi-select {\n  width: 100%;\n  min-height: 44px;\n  padding: 9px 11px;\n  border: 1px solid #cbd5e1;\n  border-radius: 6px;\n  background: var(--surface);\n  color: var(--ink);\n  font: inherit;\n  font-size: 15px;\n  font-weight: 400;\n  font-variant-numeric: tabular-nums;\n}\n.lfi-calculator .lfi-input:hover,\n.lfi-calculator .lfi-select:hover {\n  border-color: #94a3b8;\n}\n.lfi-calculator .lfi-help {\n  min-height: 20px;\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n  line-height: 1.45;\n}\n.lfi-calculator .lfi-error {\n  min-height: 20px;\n  color: #b91c1c;\n  font-size: 13px;\n  font-weight: 600;\n  line-height: 1.45;\n}\n.lfi-calculator .lfi-add-row {\n  margin-top: 12px;\n}\n.lfi-calculator .lfi-sales-grid {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n  gap: 12px;\n  margin-top: 20px;\n  padding-top: 20px;\n  border-top: 1px solid var(--border);\n}\n.lfi-calculator .lfi-primary-result {\n  padding: 20px;\n  border: 1px solid #bfdbfe;\n  border-radius: 8px;\n  background: #eff6ff;\n}\n.lfi-calculator .lfi-primary-label {\n  margin-bottom: 4px;\n  color: #1e3a8a;\n  font-size: 13px;\n  font-weight: 700;\n  text-transform: uppercase;\n  letter-spacing: .04em;\n}\n.lfi-calculator .lfi-primary-value {\n  color: #172554;\n  font-size: 30px;\n  line-height: 1.2;\n  font-weight: 700;\n  font-variant-numeric: tabular-nums;\n  overflow-wrap: anywhere;\n}\n.lfi-calculator .lfi-primary-note {\n  margin: 8px 0 0;\n  color: #334155;\n  font-size: 13px;\n  font-weight: 500;\n}\n.lfi-calculator .lfi-results-grid {\n  display: grid;\n  grid-template-columns: repeat(2, minmax(0, 1fr));\n  gap: 12px;\n  margin-top: 12px;\n}\n.lfi-calculator .lfi-result-card {\n  padding: 14px;\n  border: 1px solid var(--border);\n  border-radius: 8px;\n  background: var(--tint);\n}\n.lfi-calculator .lfi-result-label {\n  margin-bottom: 4px;\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 600;\n}\n.lfi-calculator .lfi-result-value {\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.lfi-calculator .lfi-result-value.lfi-negative {\n  color: #b91c1c;\n}\n.lfi-calculator .lfi-result-value.lfi-positive {\n  color: #047857;\n}\n.lfi-calculator .lfi-live {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  padding: 0;\n  margin: -1px;\n  overflow: hidden;\n  clip: rect(0,0,0,0);\n  white-space: nowrap;\n  border: 0;\n}\n.lfi-calculator .lfi-section {\n  margin-top: 16px;\n  padding: 24px;\n}\n.lfi-calculator .lfi-section-header {\n  margin-bottom: 18px;\n}\n.lfi-calculator .lfi-section-header p {\n  max-width: 800px;\n  margin-bottom: 0;\n  color: var(--muted);\n}\n.lfi-calculator .lfi-chart-cluster {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n  align-items: center;\n  justify-content: center;\n  gap: 24px;\n  max-width: 820px;\n  margin: 0 auto;\n}\n.lfi-calculator .lfi-chart-plot {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: min(100%, 320px);\n  aspect-ratio: 1;\n  margin: 0 auto;\n}\n.lfi-calculator .lfi-chart-svg {\n  display: block;\n  width: 100%;\n  height: auto;\n  max-width: 320px;\n  overflow: visible;\n}\n.lfi-calculator .lfi-chart-center-label {\n  fill: var(--muted);\n  font-size: 13px;\n  font-weight: 600;\n  text-anchor: middle;\n}\n.lfi-calculator .lfi-chart-center-value {\n  fill: var(--ink);\n  font-size: 20px;\n  font-weight: 700;\n  text-anchor: middle;\n  font-variant-numeric: tabular-nums;\n}\n.lfi-calculator .lfi-chart-side {\n  display: grid;\n  align-content: center;\n  gap: 16px;\n}\n.lfi-calculator .lfi-breakdown-total {\n  color: var(--ink);\n  font-size: 15px;\n  font-weight: 700;\n  font-variant-numeric: tabular-nums;\n}\n.lfi-calculator .lfi-legend {\n  display: grid;\n  gap: 10px;\n}\n.lfi-calculator .lfi-legend-row {\n  display: grid;\n  grid-template-columns: 14px minmax(80px, max-content) max-content max-content;\n  align-items: center;\n  justify-content: start;\n  gap: 8px 12px;\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 600;\n}\n.lfi-calculator .lfi-swatch {\n  width: 12px;\n  height: 12px;\n  border-radius: 3px;\n  border: 1px solid rgba(15,23,42,.16);\n}\n.lfi-calculator .lfi-legend-name {\n  color: var(--ink);\n}\n.lfi-calculator .lfi-legend-value,\n.lfi-calculator .lfi-legend-share {\n  font-variant-numeric: tabular-nums;\n}\n.lfi-calculator .lfi-chart-table-wrap {\n  max-width: 100%;\n  overflow-x: auto;\n  border: 1px solid var(--border);\n  border-radius: 6px;\n}\n.lfi-calculator .lfi-chart-table {\n  width: 100%;\n  min-width: 360px;\n  border-collapse: collapse;\n  font-size: 13px;\n}\n.lfi-calculator .lfi-chart-table th,\n.lfi-calculator .lfi-chart-table td {\n  padding: 8px 10px;\n  border-bottom: 1px solid var(--border);\n  text-align: left;\n}\n.lfi-calculator .lfi-chart-table th {\n  background: var(--tint);\n  color: var(--ink);\n  font-weight: 700;\n}\n.lfi-calculator .lfi-chart-table td:nth-child(n\/**\/+2),\n.lfi-calculator .lfi-chart-table th:nth-child(n\/**\/+2) {\n  text-align: right;\n  font-variant-numeric: tabular-nums;\n}\n.lfi-calculator .lfi-chart-table tr:last-child td {\n  border-bottom: 0;\n}\n.lfi-calculator .lfi-chart-caption {\n  max-width: 820px;\n  margin: 20px auto 0;\n  padding: 10px 12px;\n  border: 1px solid #cbd5e1;\n  border-radius: 6px;\n  background: var(--tint);\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n}\n.lfi-calculator .lfi-empty-state {\n  width: 100%;\n  padding: 20px;\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.lfi-calculator .lfi-safe-stack .lfi-chart-cluster {\n  grid-template-columns: minmax(0, 1fr) !important;\n  gap: 20px !important;\n  max-width: 560px;\n}\n.lfi-calculator .lfi-safe-stack .lfi-chart-caption {\n  margin-top: 24px !important;\n}\n.lfi-calculator .lfi-table-overflow {\n  width: 100%;\n  overflow-x: auto;\n  border: 1px solid var(--border);\n  border-radius: 8px;\n}\n.lfi-calculator .lfi-table {\n  width: 100%;\n  min-width: 980px;\n  border-collapse: collapse;\n  font-size: 13px;\n}\n.lfi-calculator .lfi-table th,\n.lfi-calculator .lfi-table td {\n  padding: 10px 12px;\n  border-bottom: 1px solid var(--border);\n  text-align: left;\n  vertical-align: middle;\n}\n.lfi-calculator .lfi-table th {\n  background: #1e3a8a;\n  color: #ffffff;\n  font-weight: 700;\n  white-space: nowrap;\n}\n.lfi-calculator .lfi-table td:nth-child(n\/**\/+3),\n.lfi-calculator .lfi-table th:nth-child(n\/**\/+3) {\n  text-align: right;\n  font-variant-numeric: tabular-nums;\n}\n.lfi-calculator .lfi-table tbody tr:hover {\n  background: #fafafa;\n}\n.lfi-calculator .lfi-table tbody tr:last-child td {\n  border-bottom: 0;\n}\n.lfi-calculator .lfi-table-note {\n  margin-top: 16px;\n  padding: 10px 12px;\n  border: 1px solid #cbd5e1;\n  border-radius: 6px;\n  background: var(--tint);\n  color: var(--muted);\n  font-size: 13px;\n  font-weight: 500;\n}\n.lfi-calculator .lfi-safe-table-stack .lfi-table-note {\n  margin-top: 24px !important;\n}\n.lfi-calculator .lfi-details {\n  border: 1px solid var(--border);\n  border-radius: 8px;\n  background: var(--surface);\n}\n.lfi-calculator .lfi-details summary {\n  padding: 14px 16px;\n  color: var(--ink);\n  font-size: 14px;\n  font-weight: 700;\n  cursor: pointer;\n}\n.lfi-calculator .lfi-details-content {\n  padding: 0 16px 16px;\n  color: var(--muted);\n  font-size: 13px;\n}\n.lfi-calculator .lfi-education {\n  margin-top: 16px;\n  padding: 28px;\n  border: 1px solid var(--border);\n  border-radius: 8px;\n  background: var(--surface);\n  box-shadow: 0 1px 2px rgba(15,23,42,.06);\n}\n.lfi-calculator .lfi-education h2 {\n  font-size: 18px;\n  line-height: 1.35;\n  font-weight: 650;\n}\n.lfi-calculator .lfi-education-section + .lfi-education-section {\n  margin-top: 28px;\n  padding-top: 24px;\n  border-top: 1px solid var(--border);\n}\n.lfi-calculator .lfi-education p:last-child {\n  margin-bottom: 0;\n}\n.lfi-calculator .lfi-formula {\n  padding: 12px 14px;\n  border-left: 4px solid var(--primary);\n  border-radius: 0 6px 6px 0;\n  background: var(--tint);\n  color: var(--ink);\n  font-weight: 650;\n  font-variant-numeric: tabular-nums;\n}\n.lfi-calculator .lfi-safe-overflow {\n  overflow-wrap: anywhere;\n}\n@container lfi-layout (min-width: 520px) {\n  .lfi-calculator .lfi-fields-grid,\n  .lfi-calculator .lfi-sales-grid {\n    grid-template-columns: repeat(2, minmax(0, 1fr));\n  }\n  .lfi-calculator .lfi-batch-row {\n    grid-template-columns: 120px minmax(0, 1fr);\n    align-items: start;\n  }\n}\n@container lfi-layout (min-width: 640px) {\n  .lfi-calculator .lfi-chart-cluster {\n    grid-template-columns: minmax(240px, 320px) minmax(300px, max-content);\n  }\n}\n@container lfi-layout (min-width: 900px) {\n  .lfi-calculator .lfi-workspace {\n    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);\n  }\n}\n@container lfi-layout (max-width: 519px) {\n  .lfi-calculator .lfi-header,\n  .lfi-calculator .lfi-toolbar,\n  .lfi-calculator .lfi-card,\n  .lfi-calculator .lfi-section,\n  .lfi-calculator .lfi-education {\n    padding-left: 16px;\n    padding-right: 16px;\n  }\n  .lfi-calculator .lfi-results-grid {\n    grid-template-columns: minmax(0, 1fr);\n  }\n  .lfi-calculator .lfi-legend-row {\n    grid-template-columns: 14px minmax(76px, max-content) max-content;\n  }\n  .lfi-calculator .lfi-legend-share {\n    grid-column: 2 \/ span 2;\n  }\n  .lfi-calculator .lfi-button {\n    padding-left: 14px;\n    padding-right: 14px;\n  }\n}\n@media (prefers-reduced-motion: reduce) {\n  .lfi-calculator .lfi-button {\n    transition: none;\n  }\n}\n\u003c\/style\u003e\n\u003cdiv class=\"lfi-calculator\" data-calculator-root\u003e\n  \u003csection class=\"lfi-header\"\u003e\n    \u003ch2\u003eLIFO Inventory Calculator\u003c\/h2\u003e\n    \u003cp class=\"lfi-header-copy\"\u003eValue cost of goods sold and ending inventory under the last-in, first-out method, then see revenue, gross profit, margin, and layer consumption update instantly.\u003c\/p\u003e\n    \u003cdiv class=\"lfi-summary-pills\" aria-label=\"Live inventory summary\"\u003e\n      \u003cspan class=\"lfi-pill\" data-lfi-pill-units\u003e14 units purchased\u003c\/span\u003e\n      \u003cspan class=\"lfi-pill\" data-lfi-pill-value\u003e$190.00 inventory\u003c\/span\u003e\n      \u003cspan class=\"lfi-pill\" data-lfi-pill-sold\u003e10 units sold\u003c\/span\u003e\n      \u003cspan class=\"lfi-pill\" data-lfi-pill-remaining\u003e4 units remaining\u003c\/span\u003e\n    \u003c\/div\u003e\n  \u003c\/section\u003e\n  \u003cdiv class=\"lfi-toolbar\" aria-label=\"Calculator actions\"\u003e\n    \u003cbutton class=\"lfi-button lfi-download\" type=\"button\" data-lfi-download\u003e\n      \u003csvg class=\"lfi-button-icon\" aria-hidden=\"true\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\u003cpath d=\"M12 3v12\"\u003e\u003c\/path\u003e\u003cpath d=\"m7 10 5 5 5-5\"\u003e\u003c\/path\u003e\u003cpath d=\"M5 21h14\"\u003e\u003c\/path\u003e\u003c\/svg\u003e\n      \u003cspan\u003eDownload Excel\u003c\/span\u003e\n    \u003c\/button\u003e\n    \u003cbutton class=\"lfi-button lfi-secondary\" type=\"button\" data-lfi-reset\u003e\n      \u003csvg class=\"lfi-button-icon\" aria-hidden=\"true\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\u003cpath d=\"M3 12a9 9 0 1 0 3-6.7\"\u003e\u003c\/path\u003e\u003cpath d=\"M3 4v6h6\"\u003e\u003c\/path\u003e\u003c\/svg\u003e\n      \u003cspan\u003eReset\u003c\/span\u003e\n    \u003c\/button\u003e\n  \u003c\/div\u003e\n\n  \u003cdiv class=\"lfi-workspace\"\u003e\n    \u003csection class=\"lfi-card\" aria-labelledby=\"lfi-inputs-heading\"\u003e\n      \u003cdiv class=\"lfi-card-heading\"\u003e\n        \u003ch3 id=\"lfi-inputs-heading\"\u003eInventory purchases\u003c\/h3\u003e\n        \u003cspan class=\"lfi-card-subtitle\"\u003eEnter batches from oldest to newest\u003c\/span\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"lfi-batches\" data-lfi-batches\u003e\u003c\/div\u003e\n      \u003cbutton class=\"lfi-button lfi-secondary lfi-add-row\" type=\"button\" data-lfi-add-batch\u003eAdd purchase batch\u003c\/button\u003e\n      \u003cdiv class=\"lfi-sales-grid\"\u003e\n        \u003cdiv class=\"lfi-field\"\u003e\n          \u003clabel class=\"lfi-label\" for=\"lfi-units-sold\"\u003eTotal units sold\u003c\/label\u003e\n          \u003cinput class=\"lfi-input\" id=\"lfi-units-sold\" data-lfi-units-sold type=\"text\" inputmode=\"numeric\" autocomplete=\"off\" value=\"10\" aria-describedby=\"lfi-units-sold-help lfi-units-sold-error\"\u003e\n          \u003cspan class=\"lfi-help\" id=\"lfi-units-sold-help\"\u003eCannot exceed total units available.\u003c\/span\u003e\n          \u003cspan class=\"lfi-error\" id=\"lfi-units-sold-error\" data-lfi-units-sold-error aria-live=\"polite\"\u003e\u003c\/span\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"lfi-field\"\u003e\n          \u003clabel class=\"lfi-label\" for=\"lfi-selling-price\"\u003eSelling price per unit\u003c\/label\u003e\n          \u003cinput class=\"lfi-input\" id=\"lfi-selling-price\" data-lfi-selling-price data-lfi-mask=\"currency\" type=\"text\" inputmode=\"decimal\" autocomplete=\"off\" value=\"16\" aria-describedby=\"lfi-selling-price-help lfi-selling-price-error\"\u003e\n          \u003cspan class=\"lfi-help\" id=\"lfi-selling-price-help\"\u003ePrice charged for each unit sold.\u003c\/span\u003e\n          \u003cspan class=\"lfi-error\" id=\"lfi-selling-price-error\" data-lfi-selling-price-error aria-live=\"polite\"\u003e\u003c\/span\u003e\n        \u003c\/div\u003e\n      \u003c\/div\u003e\n    \u003c\/section\u003e\n\n    \u003csection class=\"lfi-card\" aria-labelledby=\"lfi-results-heading\"\u003e\n      \u003cdiv class=\"lfi-card-heading\"\u003e\n        \u003ch3 id=\"lfi-results-heading\"\u003eLive results\u003c\/h3\u003e\n        \u003cspan class=\"lfi-card-subtitle\"\u003eNewest inventory costs are expensed first\u003c\/span\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"lfi-primary-result\"\u003e\n        \u003cdiv class=\"lfi-primary-label\"\u003eLIFO cost of goods sold\u003c\/div\u003e\n        \u003cdiv class=\"lfi-primary-value\" data-lfi-cogs\u003e$144.00\u003c\/div\u003e\n        \u003cp class=\"lfi-primary-note\" data-lfi-primary-note\u003e10 units are assigned to the newest available cost layers.\u003c\/p\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"lfi-results-grid\"\u003e\n        \u003cdiv class=\"lfi-result-card\"\u003e\n          \u003cdiv class=\"lfi-result-label\"\u003eEnding inventory\u003c\/div\u003e\n          \u003cdiv class=\"lfi-result-value\" data-lfi-ending\u003e$46.00\u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"lfi-result-card\"\u003e\n          \u003cdiv class=\"lfi-result-label\"\u003eRevenue\u003c\/div\u003e\n          \u003cdiv class=\"lfi-result-value\" data-lfi-revenue\u003e$160.00\u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"lfi-result-card\"\u003e\n          \u003cdiv class=\"lfi-result-label\"\u003eGross profit\u003c\/div\u003e\n          \u003cdiv class=\"lfi-result-value lfi-positive\" data-lfi-profit\u003e$16.00\u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"lfi-result-card\"\u003e\n          \u003cdiv class=\"lfi-result-label\"\u003eGross margin\u003c\/div\u003e\n          \u003cdiv class=\"lfi-result-value lfi-positive\" data-lfi-margin\u003e10.00%\u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"lfi-result-card\"\u003e\n          \u003cdiv class=\"lfi-result-label\"\u003eAverage cost sold\u003c\/div\u003e\n          \u003cdiv class=\"lfi-result-value\" data-lfi-average-cost\u003e$14.40\u003c\/div\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"lfi-result-card\"\u003e\n          \u003cdiv class=\"lfi-result-label\"\u003eLIFO vs. FIFO COGS\u003c\/div\u003e\n          \u003cdiv class=\"lfi-result-value\" data-lfi-fifo-difference\u003e$14.00 higher\u003c\/div\u003e\n        \u003c\/div\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"lfi-live\" aria-live=\"polite\" aria-atomic=\"true\" data-lfi-live\u003eLIFO COGS is $144.00; ending inventory is $46.00.\u003c\/div\u003e\n    \u003c\/section\u003e\n  \u003c\/div\u003e\n\n  \u003csection class=\"lfi-section lfi-chart-card\" aria-labelledby=\"lfi-breakdown-heading\" data-lfi-chart-card\u003e\n    \u003cdiv class=\"lfi-section-header\"\u003e\n      \u003ch3 id=\"lfi-breakdown-heading\"\u003eInventory value allocation\u003c\/h3\u003e\n      \u003cp data-lfi-breakdown-intro\u003eThe original $190.00 inventory cost is split between cost of goods sold and inventory still on hand.\u003c\/p\u003e\n    \u003c\/div\u003e\n    \u003cdiv data-lfi-chart-region\u003e\n      \u003cdiv class=\"lfi-chart-cluster\"\u003e\n        \u003cdiv class=\"lfi-chart-plot\" data-lfi-chart-plot\u003e\u003c\/div\u003e\n        \u003cdiv class=\"lfi-chart-side\"\u003e\n          \u003cdiv class=\"lfi-breakdown-total\" data-lfi-breakdown-total\u003eTotal inventory cost: $190.00\u003c\/div\u003e\n          \u003cdiv class=\"lfi-legend\" data-lfi-legend\u003e\u003c\/div\u003e\n          \u003cdiv class=\"lfi-chart-table-wrap\"\u003e\n            \u003ctable class=\"lfi-chart-table\"\u003e\n              \u003cthead\u003e\u003ctr\u003e\n\u003cth\u003eAllocation\u003c\/th\u003e\n\u003cth\u003eValue\u003c\/th\u003e\n\u003cth\u003eShare\u003c\/th\u003e\n\u003c\/tr\u003e\u003c\/thead\u003e\n              \u003ctbody data-lfi-chart-summary\u003e\u003c\/tbody\u003e\n            \u003c\/table\u003e\n          \u003c\/div\u003e\n        \u003c\/div\u003e\n      \u003c\/div\u003e\n      \u003cdiv class=\"lfi-chart-caption\" data-lfi-chart-caption\u003e75.79% of the original inventory cost has moved to COGS; 24.21% remains as an inventory asset.\u003c\/div\u003e\n    \u003c\/div\u003e\n    \u003cdiv class=\"lfi-empty-state\" data-lfi-chart-empty hidden\u003eEnter purchase batches with positive inventory value to see the allocation.\u003c\/div\u003e\n  \u003c\/section\u003e\n\n  \u003csection class=\"lfi-section lfi-table-card\" aria-labelledby=\"lfi-table-heading\" data-lfi-table-card\u003e\n    \u003cdiv class=\"lfi-section-header\"\u003e\n      \u003ch3 id=\"lfi-table-heading\"\u003eLIFO layer detail\u003c\/h3\u003e\n      \u003cp\u003eRows stay in purchase order, while the “units sold” column reveals how the newest layers are consumed first.\u003c\/p\u003e\n    \u003c\/div\u003e\n    \u003cdiv class=\"lfi-table-overflow\" data-lfi-table-overflow\u003e\n      \u003ctable class=\"lfi-table\"\u003e\n        \u003cthead\u003e\n          \u003ctr\u003e\n            \u003cth\u003eBatch\u003c\/th\u003e\n            \u003cth\u003ePurchase order\u003c\/th\u003e\n            \u003cth\u003eUnits bought\u003c\/th\u003e\n            \u003cth\u003eUnit cost\u003c\/th\u003e\n            \u003cth\u003eLayer cost\u003c\/th\u003e\n            \u003cth\u003eUnits sold\u003c\/th\u003e\n            \u003cth\u003eCOGS allocated\u003c\/th\u003e\n            \u003cth\u003eUnits remaining\u003c\/th\u003e\n            \u003cth\u003eEnding value\u003c\/th\u003e\n          \u003c\/tr\u003e\n        \u003c\/thead\u003e\n        \u003ctbody data-lfi-layer-body\u003e\u003c\/tbody\u003e\n      \u003c\/table\u003e\n    \u003c\/div\u003e\n    \u003cdiv class=\"lfi-table-note\" data-lfi-table-note\u003eThe last purchase batch is assigned to sales first. Total layer cost always equals COGS plus ending inventory.\u003c\/div\u003e\n  \u003c\/section\u003e\n\n  \u003csection class=\"lfi-section\" aria-labelledby=\"lfi-method-heading\"\u003e\n    \u003cdetails class=\"lfi-details\"\u003e\n      \u003csummary id=\"lfi-method-heading\"\u003eCalculation assumptions\u003c\/summary\u003e\n      \u003cdiv class=\"lfi-details-content\"\u003e\n        This calculator applies periodic LIFO to one SKU: purchase batches are entered chronologically, all units are assumed interchangeable, sales are limited to available units, and selling price affects revenue and margin but not inventory cost allocation. It does not model lower-of-cost-or-market adjustments, dollar-value LIFO pools, freight capitalization, returns, taxes, or physical stock movement.\n      \u003c\/div\u003e\n    \u003c\/details\u003e\n  \u003c\/section\u003e\n\n  \u003carticle class=\"lfi-education\"\u003e\n    \u003csection class=\"lfi-education-section\"\u003e\n      \u003ch2\u003eWhat does this LIFO inventory calculator estimate?\u003c\/h2\u003e\n      \u003cp\u003eThis tool applies the last-in, first-out cost-flow assumption to a sequence of inventory purchases. It estimates LIFO cost of goods sold (COGS), ending inventory value, revenue, gross profit, gross margin, average cost per unit sold, and the difference between LIFO and FIFO COGS for the same purchase history. LIFO is an accounting convention: it determines which costs are assigned to sales and which costs remain on the balance sheet. It does not require the newest physical items to leave the warehouse first.\u003c\/p\u003e\n      \u003cp\u003eThe default example contains three chronological batches: 2 units at $10, 5 units at $13, and 7 units at $15. Selling 10 units consumes all 7 units from the newest batch and 3 units from the second batch, producing $144 of LIFO COGS. The remaining inventory consists of 2 units at $10 and 2 units at $13, worth $46. At a $16 selling price, revenue is $160, gross profit is $16, and gross margin is 10%.\u003c\/p\u003e\n    \u003c\/section\u003e\n    \u003csection class=\"lfi-education-section\"\u003e\n      \u003ch2\u003eHow should each input be used?\u003c\/h2\u003e\n      \u003cp\u003e\u003cstrong\u003ePurchase batches\u003c\/strong\u003e must be entered from oldest to newest. For every batch, enter the number of units acquired and the cost paid per unit. Units are required to be whole, nonnegative counts in this calculator. Unit cost is expressed in U.S. dollars and may include cents. A higher cost in a newer layer generally raises LIFO COGS when that layer is sold, while a higher cost in an older unsold layer raises ending inventory instead. Use “Add purchase batch” whenever the SKU has another distinct acquisition cost; remove a row when that layer should not be included.\u003c\/p\u003e\n      \u003cp\u003e\u003cstrong\u003eTotal units sold\u003c\/strong\u003e is the quantity assigned to expense. It cannot exceed the total quantity purchased. Increasing units sold moves more cost from inventory to COGS, working backward from the newest batch until the requested quantity is satisfied. A value of zero leaves all purchase cost in ending inventory. \u003cstrong\u003eSelling price per unit\u003c\/strong\u003e drives revenue, gross profit, and gross margin only. It does not change COGS because inventory cost is based on purchase layers, not the selling price. A zero price is allowed and produces zero revenue; negative prices and costs are rejected.\u003c\/p\u003e\n    \u003c\/section\u003e\n    \u003csection class=\"lfi-education-section\"\u003e\n      \u003ch2\u003eHow does the LIFO calculation work?\u003c\/h2\u003e\n      \u003cp\u003eThe model first totals every purchase layer. It then starts with the most recent batch and assigns as many units as possible to the sale. If the newest batch is insufficient, the remaining sale quantity moves to the next-newest batch. This continues until all sold units are assigned or inventory is exhausted.\u003c\/p\u003e\n      \u003cp class=\"lfi-formula\"\u003eInitial inventory cost = sum of each batch’s units × unit cost\u003cbr\u003eCOGS = sum of LIFO units sold from each layer × that layer’s unit cost\u003cbr\u003eEnding inventory = initial inventory cost − COGS\u003cbr\u003eRevenue = units sold × selling price\u003cbr\u003eGross margin = gross profit ÷ revenue\u003c\/p\u003e\n      \u003cp\u003eCalculations retain full precision and display currency to two decimals. The layer table is the audit trail: its COGS allocation must sum to the primary result, its ending values must sum to ending inventory, and each row’s sold plus remaining units must equal the units originally purchased.\u003c\/p\u003e\n    \u003c\/section\u003e\n    \u003csection class=\"lfi-education-section\"\u003e\n      \u003ch2\u003eHow should the results, chart, and table be interpreted?\u003c\/h2\u003e\n      \u003cp\u003e\u003cstrong\u003eLIFO COGS\u003c\/strong\u003e is the purchase cost assigned to the units sold. A high value can reflect more units sold, higher recent purchase costs, or both. \u003cstrong\u003eEnding inventory\u003c\/strong\u003e is the cost basis still carried as an asset after the sale. Under rising costs, LIFO often leaves older, lower-cost layers in ending inventory. \u003cstrong\u003eRevenue\u003c\/strong\u003e is sales volume multiplied by selling price. \u003cstrong\u003eGross profit\u003c\/strong\u003e is revenue minus COGS; a negative result means the selling price did not cover the LIFO cost assigned to the sale. \u003cstrong\u003eGross margin\u003c\/strong\u003e expresses that profit as a percentage of revenue, while average cost sold shows COGS per unit sold.\u003c\/p\u003e\n      \u003cp\u003eThe allocation chart divides original inventory cost into COGS and ending inventory. Its two shares always total 100% when inventory has positive cost. The LIFO-versus-FIFO comparison is informational: a positive figure means LIFO assigned more cost to the current sale than FIFO; a negative figure means it assigned less. The layer table identifies exactly which batches were consumed, which makes unusual results easier to trace.\u003c\/p\u003e\n    \u003c\/section\u003e\n    \u003csection class=\"lfi-education-section\"\u003e\n      \u003ch2\u003eWhat accounting limitations and compliance issues matter?\u003c\/h2\u003e\n      \u003cp\u003eThis calculator is best used for learning, scenario analysis, and a straightforward periodic LIFO illustration. Real accounting systems may need beginning inventory, freight and other capitalized costs, purchase returns, write-downs, multiple locations, perpetual transactions, and dollar-value LIFO pools. The Internal Revenue Service discusses inventory methods and adoption procedures in \u003ca href=\"https:\/\/www.irs.gov\/publications\/p538\" target=\"_blank\" rel=\"noopener noreferrer\"\u003ePublication 538\u003c\/a\u003e, while the legal foundation for U.S. tax LIFO appears in \u003ca href=\"https:\/\/www.law.cornell.edu\/uscode\/text\/26\/472\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e26 U.S. Code § 472\u003c\/a\u003e.\u003c\/p\u003e\n      \u003cp\u003eReporting frameworks differ. U.S. entities may be able to use LIFO when applicable requirements are met, but the \u003ca href=\"https:\/\/www.ifrs.org\/issued-standards\/list-of-standards\/ias-2-inventories\/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eIAS 2 inventory standard\u003c\/a\u003e does not permit LIFO as a cost formula. Method selection can affect taxable income, financial ratios, comparability, and disclosures. Consult a qualified accounting or tax professional before adopting or changing an inventory method; this calculator does not provide accounting, legal, or tax advice.\u003c\/p\u003e\n    \u003c\/section\u003e\n  \u003c\/article\u003e\n\u003c\/div\u003e","brand":"FinancialModelsLab","offers":[{"title":"Default Title","offer_id":49909487075571,"sku":"lifo-for-inventories","price":0.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0522\/6191\/2762\/files\/lifo-for-inventories.webp?v=1783935514","url":"https:\/\/financialmodelslab.com\/products\/lifo-for-inventories","provider":"Financial Models Lab","version":"1.0","type":"link"}