Fidamen

Cost Basis Calculator

This calculator helps investors compute cost basis, proceeds, and realized gain or loss using common lot selection methods: FIFO, LIFO, Average Cost, and Specific Identification. It also supports illustrative wash-sale adjustments and a basic exchange (1031-like) illustration.

Enter up to three purchase lots and the sale details. Select the method that matches your accounting or tax reporting requirement. For Specific Identification, explicitly mark which lots were used for the sale.

Updated Nov 22, 2025QA PASS — golden 25 / edge 120Run golden-edge-2026-01-23

Governance

Record 7104163afc9f • Reviewed by Fidamen Standards Committee

Allocates sold shares to earliest purchase lots first. Purchase commissions are allocated per-share and added to the cost basis.

Inputs

Advanced inputs

1031-like exchange inputs

Results

Updates as you type

Total cost basis (FIFO)

$0.00

Cost basis per share (FIFO)

$0.00

Proceeds (net)

$0.00

Gain / (Loss)

$0.00

OutputValueUnit
Total cost basis (FIFO)$0.00USD
Cost basis per share (FIFO)$0.00USD
Proceeds (net)$0.00USD
Gain / (Loss)$0.00USD
Primary result$0.00

Visualization

Methodology

Calculations allocate purchase costs and commissions to sold shares. Purchase commissions are added to basis; sale commissions reduce proceeds. The tool includes options to reflect user-provided wash-sale disallowed amounts and exchange replacement property cost when relevant.

This implementation follows best practices for numerical calculation (IEEE 754 floating point considerations) and uses clear per-share allocations to minimize rounding ambiguity. It is for informational purposes and does not replace professional tax advice.

Worked examples

Example 1 (FIFO): Buy 100 shares at $10 + $5 commission, then 100 shares at $12 + $5 commission. Sell 150 shares at $15 with $10 commission. FIFO allocates 100 shares at $10 and 50 shares at $12 when computing basis.

Example 2 (Average): Same purchases as above. Average cost method computes a weighted average across both lots and multiplies by shares sold.

F.A.Q.

Should I rely on this calculator for filing taxes?

This tool is educational and intended to produce an accurate numeric result based on the inputs and chosen method, but it is not a substitute for tax filing software or a tax professional. Tax rules (including wash sale and exchange rules) have detailed conditions that may change the correct tax treatment.

How do I handle more than three lots?

This calculator accepts up to three purchase lots. For a larger history, aggregate older lots into a single lot (by computing weighted average for those lots) or use dedicated bookkeeping software that imports lot-level transaction history.

Why are commissions treated differently on buy vs sell?

By convention, purchase commissions are capitalized into the cost basis of the acquired shares. Sale commissions reduce the proceeds from the sale when computing gain or loss.

What is a wash sale and how is it handled here?

A wash sale occurs when substantially identical securities are bought within a specified timeframe around a loss sale, potentially disallowing the loss. This tool accepts a user-provided disallowed amount and shows the adjusted recognized gain/loss; it does not detect wash sales automatically.

Sources & citations

Further resources

Versioning & Change Control

Audit record (versions, QA runs, reviewer sign-off, and evidence).

Record ID: 7104163afc9f

What changed (latest)

v1.0.02025-11-22MINOR

Initial publication and governance baseline.

Why: Published with reviewed formulas, unit definitions, and UX controls.

Public QA status

PASS — golden 25 + edge 120

Last run: 2026-01-23 • Run: golden-edge-2026-01-23

Engine

v1.0.0

Data

Baseline (no external datasets)

Content

v1.0.0

UI

v1.0.0

Governance

Last updated: Nov 22, 2025

Reviewed by: Fidamen Standards Committee (Review board)

Credentials: Internal QA

Risk level: low

Reviewer profile (entity)

Fidamen Standards Committee

Review board

Internal QA

Entity ID: https://fidamen.com/reviewers/fidamen-standards-committee#person

Semantic versioning

  • MAJOR: Calculation outputs can change for the same inputs (formula, rounding policy, assumptions).
  • MINOR: New features or fields that do not change existing outputs for the same inputs.
  • PATCH: Bug fixes, copy edits, or accessibility changes that do not change intended outputs except for previously incorrect cases.

Review protocol

  • Verify formulas and unit definitions against primary standards or datasets.
  • Run golden-case regression suite and edge-case suite.
  • Record reviewer sign-off with credentials and scope.
  • Document assumptions, limitations, and jurisdiction applicability.

Assumptions & limitations

  • Uses exact unit definitions from the Fidamen conversion library.
  • Internal calculations use double precision; display rounding follows the unit's configured decimal places.
  • Not a substitute for calibrated instruments in regulated contexts.
  • Jurisdiction-specific rules may require official guidance.

Change log

v1.0.02025-11-22MINOR

Initial publication and governance baseline.

Why: Published with reviewed formulas, unit definitions, and UX controls.

Areas: engine, content, ui • Reviewer: Fidamen Standards Committee • Entry ID: 9f469f657cea