Engineering · April 21, 2026

Modeling 50 states of lottery tax law without losing our minds.

When we started, we thought “state tax” was going to be a column in a spreadsheet. Instead, it became a maze with seven different escape hatches. Here’s how we structured the tax engine behind Lottery Dreams — the data model, the edge cases, and the one question that mattered more than any other.

Alex Marciante · 11 min read

The naïve v1 worked for about three states

Our first version was a flat dictionary: state code to rate. California: 0. Florida: 0. New York: 10.9. Compute the cash option, multiply, subtract. The web has probably a hundred calculators that stop here. They’re all wrong — or at least misleading in ways that matter when the number has eight digits.

Why one rate is not enough

A partial list of things that actually vary:

That’s the seven-scenario matrix the app models. Each rule is small in isolation and a nightmare in combination.

The question that split the team

Does “state tax” mean what they hold back, or what you actually owe?

The withholding number is what a winner sees the day they claim — it’s tangible. The liability number is what they’ll really pay after they file. Both are useful. Conflating them is how you lose someone $30 million in expectations.

We shipped both. Every state in the app carries two values — withheld and owed — and the breakdown screen is explicit about which is which. The headline take-home uses total liability, so nothing surprises anyone in April.

The data model we landed on

Every jurisdiction reduces to a small record: its scenario type (exempt, flat, withholding-gap, refund-likely, local-surcharge, non-lottery), a withholding rate, an effective liability rate, optional local options with their own rates, and a plain-English explanation with the source. When you pick a state, the app rolls up the applicable rows into one ordered breakdown: federal withholding, federal true-up, state, then county or city.

Keeping it honest over time

Tax law changes. Every rate in the file traces to a state revenue department source, carries a last-verified date, and gets re-verified on a regular cadence before releases. It’s a small discipline, but it’s the difference between a calculator and a rumor.

The result is the take-home engine in Lottery Dreams — and the same engine powers the live calculator on this site.