PrivateACB

Documentation › United States

US Tax Formulas

Overview#

This technical guide documents the mathematical formulas and calculation processes used by PrivateACB for US lot-based tax calculations. This is a companion document to the US Tax Calculation User Guide.

Audience: Users who want to understand the mathematics behind lot-based calculations, verify results manually, or understand how PrivateACB implements IRS rules.

Scope: Formulas, equations, and calculation processes. For step-by-step usage instructions, see the user guide.


IRS Methodology#

Available Methods:

  • FIFO (First In, First Out)
  • LIFO (Last In, First Out)
  • HIFO (Highest In, First Out) Tax Authority: Internal Revenue Service (IRS) Regulatory Framework: IRS Publication 550, Form 8949, Schedule D

Key Principle: Each acquisition creates a separate “tax lot” that is tracked individually. When you sell, specific lots are consumed based on your chosen method.


Tax Lot Structure#

Each acquisition creates a tax lot with:

Lot ID: Unique identifier
Asset Symbol: BTC, ETH, etc.
Acquisition Date: When purchased
Acquisition Price: Price per unit ($/unit)
Original Quantity: How many units purchased
Remaining Quantity: How many units still held
Total Cost: (Quantity × Price) + Fees
Cost per Unit: Total Cost ÷ Quantity
Lot Method: FIFO, LIFO, or HIFO

Example:

Lot #1:
  Date: 2024-01-01
  Asset: BTC
  Quantity: 1.0 BTC
  Price: $40,000/BTC
  Fees: $200
  Total Cost: (1.0 × 40,000) + 200 = $40,200
  Cost per Unit: $40,200 ÷ 1.0 = $40,200/BTC
  Method: FIFO

Core Formulas#

1. Lot Creation (Acquisition)#

When you buy cryptocurrency:

Total Cost = (Quantity × Price) + Fees
Cost per Unit = Total Cost ÷ Quantity

CREATE LOT:
  lot_id = unique_id()
  acquisition_date = transaction_timestamp
  original_quantity = acquired_quantity
  remaining_quantity = acquired_quantity
  cost_per_unit = total_cost ÷ quantity
  total_cost = calculated above

Example:

Buy 2.5 BTC @ $35,000/BTC, fees $300

Total Cost = (2.5 × 35,000) + 300 = $87,800
Cost per Unit = $87,800 ÷ 2.5 = $35,120/BTC

Lot Created:
  ID: lot-001
  Date: 2024-02-15
  Original Qty: 2.5 BTC
  Remaining Qty: 2.5 BTC
  Cost/Unit: $35,120/BTC
  Total Cost: $87,800

2. Lot Consumption (Disposal)#

When you sell cryptocurrency, lots are consumed based on your method.

Step 1: Calculate proceeds

Proceeds = (Quantity Sold × Sale Price) - Fees

Step 2: Select lots to consume (see method-specific logic below)

Step 3: For each consumed lot:

Quantity Consumed from Lot = MIN(Lot Remaining Quantity, Quantity Still Needed)
Cost Basis from Lot = Quantity Consumed × Lot Cost per Unit

Step 4: Calculate capital gain

Total Cost Basis Consumed = SUM(Cost Basis from each consumed lot)
Capital Gain = Proceeds - Total Cost Basis Consumed

Step 5: Update lots

FOR each consumed lot:
  New Remaining Quantity = Old Remaining Quantity - Quantity Consumed
  IF New Remaining Quantity = 0 THEN
    Mark lot as fully consumed
  END IF
END FOR

Method-Specific Lot Selection#

FIFO (First In, First Out)#

Rule: Consume the oldest lots first.

Sort Order:

Sort active lots by acquisition_date ASC
  (earliest date first)

Example:

Active Lots:
  Lot A: 2024-01-01, 1.0 BTC @ $40,000/BTC
  Lot B: 2024-02-01, 1.5 BTC @ $45,000/BTC
  Lot C: 2024-03-01, 2.0 BTC @ $50,000/BTC

Sell 2.0 BTC:
  1. Consume Lot A entirely (1.0 BTC @ $40,000/BTC) = $40,000 cost basis
  2. Consume 1.0 BTC from Lot B (1.0 BTC @ $45,000/BTC) = $45,000 cost basis
  Total Cost Basis = $40,000 + $45,000 = $85,000

Remaining Lots:
  Lot B: 0.5 BTC @ $45,000/BTC
  Lot C: 2.0 BTC @ $50,000/BTC

LIFO (Last In, First Out)#

Rule: Consume the newest lots first.

Sort Order:

Sort active lots by acquisition_date DESC
  (most recent date first)

Example:

Active Lots:
  Lot A: 2024-01-01, 1.0 BTC @ $40,000/BTC
  Lot B: 2024-02-01, 1.5 BTC @ $45,000/BTC
  Lot C: 2024-03-01, 2.0 BTC @ $50,000/BTC

Sell 2.0 BTC:
  1. Consume 2.0 BTC from Lot C (2.0 BTC @ $50,000/BTC) = $100,000 cost basis
  Total Cost Basis = $100,000

Remaining Lots:
  Lot A: 1.0 BTC @ $40,000/BTC
  Lot B: 1.5 BTC @ $45,000/BTC
  Lot C: 0 BTC (fully consumed)

HIFO (Highest In, First Out)#

Rule: Consume the lots with highest cost per unit first.

Sort Order:

Sort active lots by cost_per_unit DESC
  (highest cost first)

Example:

Active Lots:
  Lot A: 2024-01-01, 1.0 BTC @ $40,000/BTC (cost per unit)
  Lot B: 2024-02-01, 1.5 BTC @ $45,000/BTC
  Lot C: 2024-03-01, 2.0 BTC @ $50,000/BTC

Sell 2.0 BTC:
  1. Consume 2.0 BTC from Lot C (2.0 BTC @ $50,000/BTC) = $100,000 cost basis
  Total Cost Basis = $100,000

Remaining Lots:
  Lot A: 1.0 BTC @ $40,000/BTC
  Lot B: 1.5 BTC @ $45,000/BTC
  Lot C: 0 BTC (fully consumed)

Note: HIFO and LIFO often select the same lots if prices are trending upward, but differ when prices fluctuate.


Capital Gain Calculation#

Short-Term vs Long-Term#

Holding Period Formula:

Holding Period (days) = Disposal Date - Acquisition Date

Classification:

IF Holding Period > 365 days THEN
  Classification = "Long-term"
ELSE
  Classification = "Short-term"
END IF

Important: Each lot’s holding period is calculated independently. A single sale can result in both short-term and long-term gains if consuming multiple lots.

Example:

Sell 2.5 BTC on 2025-01-15:
  Consume Lot A (acquired 2024-01-01): Holding = 379 days → Long-term
  Consume Lot B (acquired 2024-11-01): Holding = 75 days → Short-term

Capital Gain from Lot A → Long-term gain
Capital Gain from Lot B → Short-term gain

Full Capital Gain Formula#

For each disposal:

Proceeds = (Quantity × Sale Price) - Fees
Cost Basis = SUM(Quantity Consumed from Lot × Lot Cost per Unit)
Capital Gain = Proceeds - Cost Basis

Categorize by holding period:

FOR each lot consumed:
  IF lot holding period > 365 days THEN
    Long-term Gain += (Quantity from lot × (Sale Price - Lot Cost per Unit))
  ELSE
    Short-term Gain += (Quantity from lot × (Sale Price - Lot Cost per Unit))
  END IF
END FOR

Tax Implications:

Short-term gains: Taxed as ordinary income (10%-37% depending on tax bracket)
Long-term gains: Taxed at preferential rates (0%, 15%, or 20%)

Wash Sale Rule (Optional - Default: DISABLED)#

⚠️ IMPORTANT: Wash sale rule is DISABLED by default in PrivateACB due to regulatory uncertainty (IRS has not definitively ruled on whether cryptocurrency qualifies as a “security” under IRC §1091).

Users can enable via the Wash Sale toggle in the Config Bar (Zone A) of the ACB Calculator.


Wash Sale Detection (If Enabled)#

IRS Rule: If you sell securities at a loss and purchase substantially identical securities within 30 days before or after the sale, the loss is disallowed.

Detection Window:

Window Start = Sale Date - 30 days
Window End = Sale Date + 30 days
Total Window = 61 days

Rule Applies:

Wash Sale Detected = (Capital Gain < 0)
                   AND (Repurchase of same asset within 61-day window)

Important: Unlike Canadian superficial loss rule, the US wash sale window includes 30 days BEFORE the sale.


Wash Sale Calculation (If Enabled)#

Step 1: Detect loss transaction

IF Capital Gain < 0 THEN
  Original Loss = |Capital Gain|
END IF

Step 2: Find replacement purchases

Search all transactions for:
  - Same asset symbol
  - Acquisition type (buy, reward, mining, staking, airdrop)
  - Within window: [Sale Date - 30 days, Sale Date + 30 days]

Step 3: Deny loss (100%)

IF replacement purchases found THEN
  Denied Loss = Original Loss
  Adjusted Capital Gain = $0  (loss is fully denied)
ELSE
  Adjusted Capital Gain = Original Loss  (no wash sale, loss allowed)
END IF

Note: Unlike Canadian rule, US wash sales deny 100% of the loss (no proration based on quantity).


Cost Basis Adjustment (If Wash Sale Detected)#

The denied loss is added to the cost basis of the replacement lot.

Replacement Lot Selection:

Replacement Lot = First acquisition within the 61-day window
  (chronologically first)

Basis Adjustment:

New Cost per Unit = Old Cost per Unit + (Denied Loss ÷ Lot Quantity)
New Total Cost = Old Total Cost + Denied Loss

Example:

Jan 15: Sell 1 BTC @ $40,000 (cost basis $50,000) → $10,000 loss
Jan 25: Buy 1 BTC @ $38,000 (within 30 days after sale)

WASH SALE DETECTED:
  Original Loss = $10,000
  Denied Loss = $10,000
  Adjusted Capital Gain = $0 (cannot claim loss)

REPLACEMENT LOT ADJUSTMENT:
  Jan 25 Lot:
    Original Cost: $38,000
    Adjustment: +$10,000
    New Cost Basis: $48,000

When you sell the Jan 25 lot later:
  Cost Basis = $48,000 (includes the deferred $10,000 loss)

Wash Sale Example (If Enabled)#

Full scenario:

Initial State: 0 BTC

Transaction 1 (Jan 1): Buy 1 BTC @ $50,000
  Lot A created: 1 BTC @ $50,000/BTC

Transaction 2 (Jan 15): Sell 1 BTC @ $40,000
  Consume Lot A: 1 BTC @ $50,000/BTC
  Proceeds = $40,000
  Cost Basis = $50,000
  Capital Gain = -$10,000 (loss)

  CHECK WASH SALE:
    Window = [Dec 16, Feb 14]
    Search for repurchases...
    Found: Transaction 3 (Jan 25)

  WASH SALE APPLIES:
    Denied Loss = $10,000
    Adjusted Capital Gain = $0
    Report on Form 8949: $0 (loss denied)

Transaction 3 (Jan 25): Buy 1 BTC @ $38,000
  Lot B created: 1 BTC @ $38,000/BTC
  Wash Sale Adjustment: +$10,000
  Adjusted Cost Basis: $48,000/BTC

Transaction 4 (Mar 1): Sell 1 BTC @ $45,000
  Consume Lot B: 1 BTC @ $48,000/BTC (adjusted)
  Proceeds = $45,000
  Cost Basis = $48,000
  Capital Gain = -$3,000

  This $3,000 loss includes the deferred $10,000 from Jan 15:
    Without wash sale: Jan 15 loss = -$10,000, Mar 1 gain = +$7,000
    With wash sale: Jan 15 loss = $0, Mar 1 loss = -$3,000
    Net result: -$3,000 (same total, just timing deferred)

Report Value Calculations#

Form 8949 (Sales and Dispositions of Capital Assets)#

For each disposal transaction:

Part I (Short-term):

Description: "X.XXX BTC"
Date Acquired: Lot acquisition date(s)
Date Sold: Disposal date
Proceeds: (Quantity × Sale Price) - Fees
Cost Basis: SUM(Lot Cost Basis)
Code: W (if wash sale applied), blank otherwise
Adjustment: Denied loss amount (if wash sale)
Gain/Loss: Proceeds - Cost Basis + Adjustment

Part II (Long-term): Same format, but for lots held > 1 year.

If multiple lots consumed:

  • Can be reported as single line: “Various” for acquisition date
  • Or separate lines for each lot (more detailed)

Schedule D (Capital Gains and Losses)#

Summary totals from Form 8949:

Short-term:

Total Short-term Proceeds = SUM(all short-term sales)
Total Short-term Cost Basis = SUM(all short-term cost basis)
Net Short-term Gain/Loss = Proceeds - Cost Basis

Long-term:

Total Long-term Proceeds = SUM(all long-term sales)
Total Long-term Cost Basis = SUM(all long-term cost basis)
Net Long-term Gain/Loss = Proceeds - Cost Basis

Overall:

Net Capital Gain/Loss = Short-term + Long-term

Schedule D Part III netting (steps 1–3):

When net short-term and net long-term have opposite signs, losses cross-net against gains across categories before tax computation:

IF Net Short-term < 0 AND Net Long-term > 0:
  ST Taxable = 0
  LT Taxable = max(0, Net Long-term + Net Short-term)
ELSE IF Net Short-term > 0 AND Net Long-term < 0:
  ST Taxable = max(0, Net Short-term + Net Long-term)
  LT Taxable = 0
ELSE:
  ST Taxable = max(0, Net Short-term)
  LT Taxable = max(0, Net Long-term)

The dashboard’s Tax Summary card displays the post-netting taxable figures, not the gross totals.

Out of scope in v2.8.1: Schedule D Part III steps 4–5 — the $3,000 ordinary-income deduction (Line 21) and Part V loss carryforward — are not yet computed automatically. Apply manually if applicable to your filing.

Tax Calculation:

Short-term gains: Added to ordinary income
Long-term gains: Configurable via dashboard's Long-term rate dropdown
  - 0% rate (zero-bracket filers)
  - 15% rate (middle brackets)
  - 20% rate (high-income filers)

Note on NIIT: the 3.8% Net Investment Income Tax (Section 1411) applies to long-term gains for filers above MAGI thresholds. PrivateACB’s dashboard does not expose 23.8% as a dropdown option; if NIIT applies to your filing, add it manually to the engine’s 20% LTCG figure.


Weighted Average Age#

PrivateACB calculates a weighted average holding period:

FOR each active lot:
  Lot Age (days) = Current Date - Acquisition Date
  Lot Weight = Lot Quantity ÷ Total Quantity

Weighted Average Age = SUM(Lot Age × Lot Weight)

Example:

Active Lots:
  Lot A: 1.0 BTC, 500 days old
  Lot B: 0.5 BTC, 200 days old
  Lot C: 2.0 BTC, 100 days old
  Total: 3.5 BTC

Weights:
  Lot A: 1.0 ÷ 3.5 = 0.286
  Lot B: 0.5 ÷ 3.5 = 0.143
  Lot C: 2.0 ÷ 3.5 = 0.571

Weighted Average Age:
  = (500 × 0.286) + (200 × 0.143) + (100 × 0.571)
  = 143 + 28.6 + 57.1
  = 228.7 days

Method Efficiency#

PrivateACB calculates how well your chosen method minimized taxes:

Theoretical Worst-Case Gain = IF used method that maximizes gains
Actual Gain = Realized gains using chosen method

Method Efficiency = (Worst-Case - Actual) ÷ Worst-Case × 100%

Interpretation:

  • 80-100%: Excellent tax optimization
  • 60-79%: Good reduction in taxes
  • 40-59%: Fair benefit
  • <40%: Minimal benefit from method choice

Processing Order#

Critical: Transactions must be processed in strict chronological order.

  1. Sort all transactions by timestamp (ascending)
  2. For each transaction (in order):
    • If acquisition: Create new lot
    • If disposal:
      • Select lots based on method (FIFO/LIFO/HIFO)
      • Consume lots in selection order
      • Calculate capital gain
      • Check wash sale rule (if enabled)
      • Apply adjustments if wash sale detected
      • Update lot quantities
  3. Calculate short-term vs long-term categorization
  4. Generate Form 8949 records
  5. Calculate Schedule D totals

Currency Conversion#

When transactions are in CAD (or other non-USD currencies):

Converted Amount:

USD Amount = CAD Amount ÷ Exchange Rate for transaction date

Example:

Buy 1 BTC @ $13,500 CAD on Jan 1, 2024
Exchange Rate (CAD/USD) on Jan 1, 2024 = 0.7407  (or USD/CAD = 1.3500)

Total Cost in USD = $13,500 CAD × 0.7407 = $10,000 USD

All lot calculations use USD amounts. The cost per unit and capital gains are all in USD.


Edge Cases#

Partial Lot Consumption#

When a sale consumes part of a lot:

Lot: 2.0 BTC @ $40,000/BTC
Sell: 0.5 BTC

Consumed: 0.5 BTC
Cost Basis: 0.5 × $40,000 = $20,000
Remaining in Lot: 2.0 - 0.5 = 1.5 BTC
Lot still active with 1.5 BTC @ $40,000/BTC

Multiple Lots Consumed#

A single sale may consume multiple lots:

Lot A: 1.0 BTC @ $40,000/BTC
Lot B: 1.5 BTC @ $45,000/BTC
Sell: 2.0 BTC (FIFO)

Consume Lot A entirely: 1.0 × $40,000 = $40,000
Consume 1.0 from Lot B: 1.0 × $45,000 = $45,000
Total Cost Basis: $85,000

Lot A: Fully consumed (deleted)
Lot B: 0.5 BTC remaining

Zero Lots Remaining#

When all lots are fully consumed:

No active lots
Total Quantity = 0
Total Cost Basis = 0
Next acquisition creates first lot again

Wash Sale Chains (If Enabled)#

Wash sales can trigger repeatedly:

Jan 1: Buy 1 BTC @ $50,000 (Lot A)
Jan 15: Sell 1 BTC @ $40,000 → $10,000 loss
Jan 20: Buy 1 BTC @ $38,000 (Lot B) → Wash sale, loss denied
Feb 1: Sell 1 BTC @ $35,000 → Lot B cost = $48,000 → $13,000 loss
Feb 5: Buy 1 BTC @ $34,000 (Lot C) → Another wash sale

First wash sale: $10,000 denied, added to Lot B
Second wash sale: $13,000 denied, added to Lot C
Lot C cost basis = $34,000 + $13,000 = $47,000

Eventually, when you sell without repurchasing:
  All deferred losses are realized

Database Storage#

PrivateACB stores calculation results in structured database tables:

tax_lots table:

  • One record per lot
  • Stores: acquisition_date, original_quantity, remaining_quantity, cost_per_unit, total_cost
  • remaining_quantity decreases as lot is consumed
  • Deleted when remaining_quantity reaches 0

capital_gains table:

  • One record per disposal
  • Stores: proceeds, cost_basis, capital_gain, holding_period, short_long_term
  • If wash_sale_applied = 1, capital_gain is adjusted (often $0)

wash_sales table (if wash sales enabled):

  • One record per detected wash sale
  • Stores: loss_amount, adjustment_amount, replacement_lot_id
  • Links to original disposal and replacement lot

Verification Process#

To manually verify a lot-based calculation:

  1. Obtain transaction list (sorted chronologically)
  2. For each acquisition:
    • Create lot with total cost = (qty × price) + fees
  3. For each disposal:
    • Select lots based on method (FIFO/LIFO/HIFO)
    • Calculate cost basis = SUM(consumed lot costs)
    • Calculate proceeds = (qty × price) - fees
    • Capital gain = proceeds - cost basis
    • Check wash sale if enabled and loss
  4. Compare results to PrivateACB output:
    • Number of active lots should match
    • Total cost basis should match
    • Capital gains should match (per transaction)
    • Short-term vs long-term split should match

If discrepancy found:

  • Verify correct method (FIFO/LIFO/HIFO) was used
  • Check lot selection order (oldest for FIFO, newest for LIFO, highest cost for HIFO)
  • Verify fees are included in acquisition costs
  • Verify fees are subtracted from proceeds
  • Check wash sale detection (if enabled)

Regulatory References#

IRS Publications:

Cryptocurrency Guidance:

Note: IRS has not definitively ruled on whether wash sale rules apply to cryptocurrency (treated as property, not securities). PrivateACB implements the rule as optional (default: disabled) for users who wish to apply it conservatively.


Summary#

Key Formulas:

Lot Creation:

Total Cost = (Quantity × Price) + Fees
Cost per Unit = Total Cost ÷ Quantity

Lot Selection:

FIFO: Sort by date ASC (oldest first)
LIFO: Sort by date DESC (newest first)
HIFO: Sort by cost_per_unit DESC (highest cost first)

Capital Gain:

Cost Basis = SUM(Consumed Lot Quantity × Lot Cost per Unit)
Capital Gain = Proceeds - Cost Basis

Wash Sale (If Enabled):

IF loss AND repurchase within 61 days THEN
  Denied Loss = |Loss|
  Adjusted Gain = $0
  Replacement Lot Cost += Denied Loss
END IF

Holding Period:

IF (Disposal Date - Acquisition Date) > 365 days THEN
  Long-term gain (taxed at 0%-20%)
ELSE
  Short-term gain (taxed as ordinary income)
END IF

For procedural instructions, see: US Tax Calculation User Guide

Last Updated: July 2026 PrivateACB Version: 2.12.0 Regulatory Authority: Internal Revenue Service (IRS)