UK Tax Calculator for Capital Gains and Income.
Calculates UK taxes from JSON transaction input, implementing HMRC share identification rules for CGT (same-day, bed & breakfast, section 104 pool).
cargo install --git https://github.com/ascjones/taxcAll commands accept an optional positional FILE (JSON). If omitted or set to -, input is read from stdin.
taxc summary transactions.json -y 2025
taxc report transactions.json
taxc pools transactions.json --daily
taxc schema input
Aggregated CGT and income calculations. Use -y 2025 for a tax year, or --from/--to for a date range. Add --json for machine-readable output, -t higher for different tax bands.
Self-contained HTML report opened in your browser, with summary cards, interactive filtering (including a multi-asset autocomplete filter with removable pills), sortable columns, color-coded tags/rules, and a Tax Years view with a per-year gain/loss chart and breakdown table. Rows expand to a detail card with description, fees, warnings, and disposal matching details. Use -o file.html to save instead, or --json for structured data.
Section 104 pool balances over time. Year-end snapshots by default, or --daily for daily history.
Print JSON schemas for input (taxc schema input, default) or output (taxc schema output) formats. Schemas are also checked into schema/ for version tracking.
All filtering commands share: -y/--from/--to (date), -a (asset), --event-kind (disposal/acquisition), --exclude-unlinked.
JSON with top-level assets and transactions fields. Run taxc schema input for the full schema.
Three transaction types: Trade (asset swap via sold/bought), Deposit (asset received), Withdrawal (asset sent). Transactions can be tagged for tax classification (income types, gifts, transfers, no gain/no loss).
All quantities must be positive and fee amounts non-negative; transactions violating this are rejected with an error.
{
"assets": [
{ "symbol": "BTC" },
{ "symbol": "ETH" },
{ "symbol": "AAPL", "asset_class": "Stock" }
],
"transactions": [
{
"id": "tx-001",
"datetime": "2024-01-02T09:00:00+00:00",
"account": "kraken",
"type": "Trade",
"sold": { "asset": "GBP", "quantity": 1000 },
"bought": { "asset": "BTC", "quantity": 0.025 }
},
{
"id": "tx-002",
"datetime": "2024-08-31T10:00:00+00:00",
"account": "kraken",
"type": "Trade",
"sold": { "asset": "BTC", "quantity": 0.01 },
"bought": { "asset": "ETH", "quantity": 0.5 },
"valuation": { "base": "ETH", "rate": 2000, "quote": "USD", "fx_rate": 0.79 }
},
{
"id": "tx-003",
"datetime": "2024-10-01T00:00:00+00:00",
"account": "ledger",
"type": "Deposit",
"tag": "StakingReward",
"amount": { "asset": "ETH", "quantity": 0.01 },
"valuation": 20
}
]
}CGT calculations implement the HMRC share matching rules in order:
- Same-Day Rule - Match disposals with acquisitions on the same day
- Bed & Breakfast Rule - Match with acquisitions within 30 days after disposal
- Section 104 Pool - Match remaining shares from the pooled cost basis
CGT annual exempt amounts and rates (non-residential-property assets, e.g. crypto and shares):
| Tax years | Annual exempt amount | Basic rate | Higher rate |
|---|---|---|---|
| 2024/25 onwards | £3,000 | 18% | 24% |
| 2023/24 | £6,000 | 10% | 20% |
| 2016/17 – 2022/23 | £11,100 – £12,300 | 10% | 20% |
| 2010/11 – 2015/16 | £11,000 – £11,100 | 18% | 28% |
Note: CGT rates changed mid-year on 30 October 2024 (10%/20% → 18%/24%). Estimates for 2024/25 use the post-change rates throughout, so gains realised before that date are over-estimated. Exempt amounts and rates for 2014/15 and earlier are approximate.
Income tax on miscellaneous income (e.g. staking rewards) uses flat 20%/40%/45% rates for basic, higher, and additional rate taxpayers.
Enable pre-commit hooks (runs fmt, clippy, and tests):
git config core.hooksPath .githookssrc/main.rs- CLI entry pointsrc/cmd/- CLI command implementationssrc/core/- Domain logic and tax calculations (flat public surface via re-exports)
MIT