US Tax Formulas
Overview
Section titled “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
Section titled “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
Section titled “Tax Lot Structure”Each acquisition creates a tax lot with:
Lot ID: Unique identifierAsset Symbol: BTC, ETH, etc.Acquisition Date: When purchasedAcquisition Price: Price per unit ($/unit)Original Quantity: How many units purchasedRemaining Quantity: How many units still heldTotal Cost: (Quantity × Price) + FeesCost per Unit: Total Cost ÷ QuantityLot Method: FIFO, LIFO, or HIFOExample:
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: FIFOCore Formulas
Section titled “Core Formulas”1. Lot Creation (Acquisition)
Section titled “1. Lot Creation (Acquisition)”When you buy cryptocurrency:
Total Cost = (Quantity × Price) + FeesCost 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 aboveExample:
Buy 2.5 BTC @ $35,000/BTC, fees $300
Total Cost = (2.5 × 35,000) + 300 = $87,800Cost 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,8002. Lot Consumption (Disposal)
Section titled “2. Lot Consumption (Disposal)”When you sell cryptocurrency, lots are consumed based on your method.
Step 1: Calculate proceeds
Proceeds = (Quantity Sold × Sale Price) - FeesStep 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 UnitStep 4: Calculate capital gain
Total Cost Basis Consumed = SUM(Cost Basis from each consumed lot)Capital Gain = Proceeds - Total Cost Basis ConsumedStep 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 IFEND FORMethod-Specific Lot Selection
Section titled “Method-Specific Lot Selection”FIFO (First In, First Out)
Section titled “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/BTCLIFO (Last In, First Out)
Section titled “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)
Section titled “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
Section titled “Capital Gain Calculation”Short-Term vs Long-Term
Section titled “Short-Term vs Long-Term”Holding Period Formula:
Holding Period (days) = Disposal Date - Acquisition DateClassification:
IF Holding Period > 365 days THEN Classification = "Long-term"ELSE Classification = "Short-term"END IFImportant: 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 gainCapital Gain from Lot B → Short-term gainFull Capital Gain Formula
Section titled “Full Capital Gain Formula”For each disposal:
Proceeds = (Quantity × Sale Price) - FeesCost Basis = SUM(Quantity Consumed from Lot × Lot Cost per Unit)Capital Gain = Proceeds - Cost BasisCategorize 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 IFEND FORTax 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)
Section titled “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)
Section titled “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 daysWindow End = Sale Date + 30 daysTotal Window = 61 daysRule 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)
Section titled “Wash Sale Calculation (If Enabled)”Step 1: Detect loss transaction
IF Capital Gain < 0 THEN Original Loss = |Capital Gain|END IFStep 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 IFNote: Unlike Canadian rule, US wash sales deny 100% of the loss (no proration based on quantity).
Cost Basis Adjustment (If Wash Sale Detected)
Section titled “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 LossExample:
Jan 15: Sell 1 BTC @ $40,000 (cost basis $50,000) → $10,000 lossJan 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)
Section titled “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
Section titled “Report Value Calculations”Form 8949 (Sales and Dispositions of Capital Assets)
Section titled “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 dateProceeds: (Quantity × Sale Price) - FeesCost Basis: SUM(Lot Cost Basis)Code: W (if wash sale applied), blank otherwiseAdjustment: Denied loss amount (if wash sale)Gain/Loss: Proceeds - Cost Basis + AdjustmentPart 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)
Section titled “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 BasisLong-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 BasisOverall:
Net Capital Gain/Loss = Short-term + Long-termTax Calculation:
Short-term gains: Added to ordinary incomeLong-term gains: - 0% rate if taxable income < threshold - 15% rate if taxable income in middle brackets - 20% rate if taxable income > high thresholdWeighted Average Age
Section titled “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 daysMethod Efficiency
Section titled “Method Efficiency”PrivateACB calculates how well your chosen method minimized taxes:
Theoretical Worst-Case Gain = IF used method that maximizes gainsActual 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
Section titled “Processing Order”Critical: Transactions must be processed in strict chronological order.
- Sort all transactions by timestamp (ascending)
- 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
- Calculate short-term vs long-term categorization
- Generate Form 8949 records
- Calculate Schedule D totals
Currency Conversion
Section titled “Currency Conversion”When transactions are in CAD (or other non-USD currencies):
Converted Amount:
USD Amount = CAD Amount ÷ Exchange Rate for transaction dateExample:
Buy 1 BTC @ $13,500 CAD on Jan 1, 2024Exchange 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 USDAll lot calculations use USD amounts. The cost per unit and capital gains are all in USD.
Edge Cases
Section titled “Edge Cases”Partial Lot Consumption
Section titled “Partial Lot Consumption”When a sale consumes part of a lot:
Lot: 2.0 BTC @ $40,000/BTCSell: 0.5 BTC
Consumed: 0.5 BTCCost Basis: 0.5 × $40,000 = $20,000Remaining in Lot: 2.0 - 0.5 = 1.5 BTCLot still active with 1.5 BTC @ $40,000/BTCMultiple Lots Consumed
Section titled “Multiple Lots Consumed”A single sale may consume multiple lots:
Lot A: 1.0 BTC @ $40,000/BTCLot B: 1.5 BTC @ $45,000/BTCSell: 2.0 BTC (FIFO)
Consume Lot A entirely: 1.0 × $40,000 = $40,000Consume 1.0 from Lot B: 1.0 × $45,000 = $45,000Total Cost Basis: $85,000
Lot A: Fully consumed (deleted)Lot B: 0.5 BTC remainingZero Lots Remaining
Section titled “Zero Lots Remaining”When all lots are fully consumed:
No active lotsTotal Quantity = 0Total Cost Basis = 0Next acquisition creates first lot againWash Sale Chains (If Enabled)
Section titled “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 lossJan 20: Buy 1 BTC @ $38,000 (Lot B) → Wash sale, loss deniedFeb 1: Sell 1 BTC @ $35,000 → Lot B cost = $48,000 → $13,000 lossFeb 5: Buy 1 BTC @ $34,000 (Lot C) → Another wash sale
First wash sale: $10,000 denied, added to Lot BSecond wash sale: $13,000 denied, added to Lot CLot C cost basis = $34,000 + $13,000 = $47,000
Eventually, when you sell without repurchasing: All deferred losses are realizedDatabase Storage
Section titled “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
Section titled “Verification Process”To manually verify a lot-based calculation:
- Obtain transaction list (sorted chronologically)
- For each acquisition:
- Create lot with total cost = (qty × price) + fees
- 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
- 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
Section titled “Regulatory References”IRS Publications:
- Publication 550: Investment Income and Expenses
- Form 8949 Instructions
- Schedule D Instructions
- IRC §1091: Wash Sale Rule
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
Section titled “Summary”Key Formulas:
Lot Creation:
Total Cost = (Quantity × Price) + FeesCost per Unit = Total Cost ÷ QuantityLot 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 BasisWash Sale (If Enabled):
IF loss AND repurchase within 61 days THEN Denied Loss = |Loss| Adjusted Gain = $0 Replacement Lot Cost += Denied LossEND IFHolding 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 IFFor procedural instructions, see: US Tax Calculation User Guide
Last Updated: February 2026 PrivateACB Version: 2.0 Regulatory Authority: Internal Revenue Service (IRS)