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.
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:
- Exempt states. Nine jurisdictions don’t tax lottery winnings — seven with no income tax at all, plus California and Delaware which exempt lottery prizes specifically.
- Withholding vs. liability. The rate your state holds back at the window is often not the rate you owe at filing. Massachusetts withholds 5% but a jackpot lands in its 9% millionaire-surtax territory — the largest gap in the nation.
- Flat vs. progressive. Pennsylvania is a flat 3.07%. New York scales to 10.9% at the top.
- Local surtaxes. NYC (+3.876%) and Yonkers, all 24 Maryland counties, and all 92 Indiana counties add their own layer.
- Withheld vs. owed locals. Some local taxes come out at the window; Marion County’s famously doesn’t — it’s due at filing.
- Non-lottery states. Alabama, Alaska, Hawaii, Nevada, and Utah don’t sell these games at all — but may tax a resident’s out-of-state win.
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.