HSA as Retirement Account: Tracking the Triple Tax Advantage in Beancount

The HSA is arguably the BEST retirement savings vehicle available - better than 401k, better than Roth IRA. Why? It’s the only account with a triple tax advantage:

  1. Tax-deductible contributions (like Traditional 401k)
  2. Tax-free growth (like all retirement accounts)
  3. Tax-free withdrawals for medical expenses (better than anything else!)

For 2026, limits are $4,400 (individual) or $8,750 (family), plus $1,000 catch-up if 55+.

The Strategy: Pay Out-of-Pocket, Invest the HSA

The real power play: don’t use your HSA for current medical expenses. Pay those out of pocket, invest your HSA aggressively, and reimburse yourself decades later (there’s no time limit on reimbursements!).

My Beancount HSA Structure

; HSA accounts
2020-01-01 open Assets:HSA:Cash USD
2020-01-01 open Assets:HSA:Investments:VTSAX VTSAX
2020-01-01 open Income:HSA:Contributions USD
2020-01-01 open Income:HSA:EmployerContributions USD

; Medical expense tracking (for future reimbursement)
2020-01-01 open Expenses:Medical:Unreimbursed USD
2020-01-01 open Assets:HSA:ReimbursementBank USD  ; running total of eligible expenses

Recording Contributions

2026-01-15 * "Employer" "HSA contribution via payroll"
  Assets:HSA:Cash    336.54 USD  ; $8,750 / 26 paychecks
  Income:HSA:Contributions    -269.23 USD
  Income:HSA:EmployerContributions    -67.31 USD
    employer-match: TRUE

The Receipt Tracking System

This is the key - track every medical expense you pay out of pocket:

2026-02-10 * "Dentist" "Annual cleaning - paid out of pocket"
  Expenses:Medical:Dental    250.00 USD
  Assets:Checking    -250.00 USD
  Assets:HSA:ReimbursementBank    250.00 USD
    receipt: "2026/dental-cleaning-receipt.pdf"
    hsa-eligible: TRUE
    reimbursed: FALSE

My Reimbursement Bank Query

SELECT sum(position) as available_reimbursement
WHERE account = 'Assets:HSA:ReimbursementBank'
  AND meta('reimbursed') = FALSE

After 20 years of this strategy, I have $47,000 in documented unreimbursed medical expenses. That’s $47,000 I can withdraw tax-free anytime!

Questions:

  1. How detailed do you track HSA-eligible expenses?
  2. Anyone using a separate file for receipt documentation?

The receipt documentation question is critical. The IRS can ask for proof of HSA-eligible expenses years later - there’s no statute of limitations when you’re claiming decades-old expenses!

What I Recommend for Audit Protection

Every receipt needs:

  1. Date of service
  2. Provider name
  3. Description of service (must be HSA-eligible)
  4. Amount paid
  5. Proof it was paid out-of-pocket (not reimbursed by insurance)

My Documentation Structure

documents/
├── hsa-receipts/
│   ├── 2020/
│   │   ├── 2020-03-15-dentist-cleaning.pdf
│   │   ├── 2020-03-15-dentist-cleaning-eob.pdf
│   │   └── ...
│   ├── 2021/
│   └── 2026/
└── hsa-master-log.csv

The Master Log

I maintain a CSV that Beancount can reference:

date,provider,description,amount,receipt_file,eob_file,reimbursed
2026-02-10,Dr Smith Dental,Annual cleaning,250.00,2026/dental.pdf,2026/dental-eob.pdf,FALSE

2026 Changes: More People Eligible!

Big news for 2026: HSA eligibility rules expanded. More HDHP plans now qualify, making millions more Americans eligible for the triple tax benefit. Check if you became eligible this year!

Age 65+ Flexibility

Don’t forget: after age 65, HSA funds can be used for anything without penalty (just pay regular income tax, like a Traditional IRA). So even if you somehow run out of medical receipts, the money isn’t trapped.

I use a dedicated Beancount file for HSA tracking with Fava documents plugin integration.

My HSA File Structure

; hsa.beancount - imported into main ledger

option "documents" "documents/hsa"

2020-01-01 open Assets:HSA:Fidelity:Cash USD
2020-01-01 open Assets:HSA:Fidelity:FSKAX FSKAX
2020-01-01 open Assets:HSA:ReimbursementEligible USD

; Document directive links receipts to transactions
2026-02-10 document Assets:HSA:ReimbursementEligible "2026/dental-receipt.pdf"

Investment Allocation

I treat my HSA like an aggressive retirement account since I won’t touch it for decades:

; Monthly investment sweep
2026-02-01 * "Fidelity" "HSA investment - buy FSKAX"
  Assets:HSA:Fidelity:Cash    -500.00 USD
  Assets:HSA:Fidelity:FSKAX    3.2154 FSKAX @ 155.50 USD
    investment-strategy: "aggressive"

My HSA Performance Query

SELECT 
  account,
  sum(cost(position)) as cost_basis,
  sum(value(position)) as current_value
WHERE account ~ 'HSA:.*:FSKAX'

The “Receipt Shoebox” Approach

For those who find detailed tracking overwhelming: just save every medical receipt in a folder. Don’t categorize, don’t log. When you’re ready to reimburse in 20 years, you can add up all receipts then.

The key is having the receipts - the tracking in Beancount is just for peace of mind and running totals.

One thing clients often miss: HSA contribution timing matters for tax purposes!

Form 8889 Compliance

You must file Form 8889 with your tax return every year you have an HSA, even if you made no contributions. Your Beancount data should easily generate this:

-- Annual HSA summary for Form 8889
SELECT 
  'Contributions' as category,
  sum(position) as amount
WHERE account ~ 'Income:HSA:Contributions'
  AND year = 2026

UNION

SELECT 
  'Distributions' as category,
  sum(position) as amount  
WHERE account ~ 'Assets:HSA'
  AND number < 0
  AND year = 2026

Common Pitfalls I See

  1. Last-month rule gotcha: If you gain HSA eligibility mid-year and contribute the full annual limit using the “last-month rule,” you must remain HSA-eligible for the ENTIRE following year or face taxes + penalties.

  2. Medicare enrollment: You must STOP HSA contributions when you enroll in Medicare (even Part A). Many people don’t realize signing up for Social Security after 65 auto-enrolls them in Medicare Part A retroactively.

  3. Spouse HDHP coverage: If your spouse has non-HDHP coverage that covers you, you may not be HSA-eligible even if your own plan is an HDHP.

; Track eligibility changes
2026-07-01 custom "hsa-eligibility" "Changed to non-HDHP plan"
  hsa-eligible: FALSE
  reason: "Employer changed plans"

Document your eligibility status changes - it’s essential for audit defense!