Computation Methodology

A detailed look at how OpenTax computes tax returns and the engineering decisions that ensure correctness. Every design choice is aimed at producing results you can verify independently.

1

Deterministic rules engine

The OpenTax rules engine is a collection of pure TypeScript functions organized by tax year (e.g., src/rules/2025/). Each function takes typed inputs and returns typed outputs with no side effects, no network calls, and no randomness.

Given the same inputs, the engine always produces the same outputs. This property is critical for tax computation: you should be able to run the engine today and next month and get identical results. It also makes the engine straightforward to test — every function can be unit-tested in isolation.

// Every computation is a pure function
function computeTaxableIncome(agi: number, deduction: number): number {
return Math.max(0, agi - deduction);
}
2

Traced values

Every number in an OpenTax return is a TracedValue — not just a dollar amount, but a data structure that records where the value came from and how it was computed.

Each TracedValue carries:

This means you can click any number on your return and trace it back through every intermediate calculation to the original source documents. No black boxes.

3

Integer arithmetic

All monetary values in OpenTax are stored as integer cents, not floating-point dollars. This eliminates an entire class of rounding errors that plague financial software.

In standard floating-point arithmetic, 0.1 + 0.2 === 0.30000000000000004. When you're computing someone's tax liability, this kind of imprecision is unacceptable. By using integer cents:

// $85,000.00 is stored as 8500000 cents
const wages = 8500000; // integer cents
const deduction = 1575000; // $15,750.00
const taxable = wages - deduction; // 6925000 = $69,250.00 exactly

Values are only converted to dollars for display. All intermediate calculations use exact integer math.

4

Extensive test suite

The OpenTax rules engine has 900+ automated tests across multiple layers:

Unit tests

Each rules file (e.g., taxComputation.ts, childTaxCredit.ts) has its own test file with hand-calculated expected values cross-referenced against IRS worksheets.

Integration tests

End-to-end scenarios that feed complete tax situations through the engine and verify every line of Form 1040. These test the full dependency graph, not just individual functions.

Boundary tests

Phase-out thresholds, bracket boundaries, credit caps, and edge cases (e.g., zero income, maximum values) are tested to ensure correct behavior at every transition point.

Regression tests

Every tax-accuracy bug report is converted into a permanent test case, preventing the same issue from recurring.

You can run the entire test suite yourself with npm test after cloning the repository.

5

Client-side computation

All tax computation runs entirely in your browser. Your W-2s, 1099s, and personal information never leave your device. There is no server-side processing, no account creation, and no data transmission.

This architecture means:

For more details, see our Privacy Policy.

Computation flow

When you prepare a return with OpenTax, data flows through these stages:

A

Document intake

Upload W-2s, 1099s, and other documents. OCR (Tesseract.js, running locally) extracts values. Every extracted value gets a confidence score. You review and correct any misreads.

B

Guided interview

A 39-step interview collects additional information: filing status, dependents, deduction preferences, and situations not captured by documents. Tooltips cite the relevant IRS publication for each question.

C

Rules engine execution

The engine resolves a dependency graph of computation nodes: income aggregation, AGI calculation, deductions, tax computation (ordinary + QDCG), credits, other taxes (AMT, NIIT, Additional Medicare), and final balance due or refund.

D

Review & output

You review the completed return with full traceability. Click any number to see the computation chain back to source documents. Download IRS-ready PDF forms for filing.

Review the rules engine source code yourself.