Lurker News
I wanted to share a simple web app I created recently, which lets you estimate income taxes owed in the US: https://taxsim.app

All the calculations occur directly in the browser, and are powered by a Fortran program that has been converted to WASM using emscripten. This calculator was originally developed in the 1970s [1] by the non-profit National Bureau of Economic Research. NBER has been maintaining this F77 codebase for the last 50 years, and uses it primarily for academic research on tax policy. The Fortran source code itself is over 1MB of text, because it codifies both federal and all 50 states' tax laws for each of the last 62 years.
I first learned about NBER TAXSIM [2] a few months ago via an interesting paper they published "Automatic Tax Filing: Simulating a Pre-Populated Form 1040" [3]. The Fortran code itself is not open-source, but is available on request for research purposes. I reached out to NBER and proposed compiling it to WASM, so it could be run directly in a browser. With relatively little effort I was able to create a js/wasm version [4], thanks in huge part to previous open-source work [5].
This WASM build now powers https://taxsim.app, which is my attempt to create an interactive UI to allow for easier exploration of the US tax code. Specific tax scenarios can also be shared easily, by simply copying the browser URL. The code for this webapp is also open-source [6].
This was my first time experimenting with WASM, and I am already a huge fan. Not only was I able to take a 60 year old codebase and get it working on every modern browser and device, this work is also now benefiting the academic community. For example, the js/wasm can be run directly in V8, which means it can also now be run locally within R using libv8 [7]. Previously most researchers were uploading their tax scenarios to NBER's servers via ftp/ssh/http.
[1] https://taxsim.nber.org/feenberg-coutts.pdf
[2] https://taxsim.nber.org/
[3] https://www.nber.org/papers/w30008
[4] https://github.com/tmm1/taxsim.js
[5] https://chrz.de/2020/04/21/fortran-in-the-browser/
[6] https://github.com/tmm1/taxsim.app
[7] https://github.com/shanejorr/usincometaxes/pull/11

Comments (155) 41 threads

Earlier comments
KerrAvon2 replies#
I wish this would get written up in mainstream media. Hypothesis being that if more people knew this existed, it would put additional pressure on Congress to simplify tax filing.
divbzero3 replies#
The number of possible inputs for Income is stunning: 15 types of income in total.

There are “only” 5 possible inputs under Deductions & Credits but 3 of them are categories with several subitems:
Itemized Deductions
• Home mortgage interest
• Deductible medical expenses
• Motor Vehicle registration fees
• Charitable contributions
• Casulty or Theft losses
Other Itemized Deductions
• Other state and local taxes
• Deductible medical expenses (preference share only)
• Miscellaneous expenses
Other Adjustments
• Alimony Paid
• Keogh and IRA contributions
• Foreign Income Exclusion
• Net Operating Losses

lotsofpulp1 reply#
Because standard deduction is so high now, 90% of US tax filers do not have to worry about itemizing. According to IRS stats website, which I do not have handy on my phone.
physicsguy1 reply#
This is kind of mental. In the UK we have nowhere near as many tax deductible things. An ordinary employed person will only ever get tax deductions for pension contributions or charitable donations. Almost nobody in the UK even has to file a tax return; data is returned automatically to the government by all employers and so there is no need unless you have certain uncommon circumstances.

There are some schemes through employers that reduce your taxable income (for e.g. a scheme to purchase a bicycle tax free) but these are handled by your employer and work by sacrificing some salary in exchange for the benefits.

pjc50#
A piece of politics that is radically different is that the UK does not have a right wing which hates the Federal government; the UK right wing is not only unitary-statist but monarchist.

This results in perverse pressures to make the Federal processes that people are exposed to, such as tax filing, as bad as possible so that voters also hate the Federal government.

m0llusk#
Potentially interesting to note that the home mortgage interest and state tax deductions were long controversial as perverse incentives and got dropped during the Trump administration.
MaxGhenis#
And for all the complexity of the tax code, it often pales in comparison to the version of the tax code we subject low-income families to: rules for means-tested benefits.
petercooper2 replies#
The US personal tax code looks extremely complicated to British eyes, but British people have a similar calculator at their disposal at https://listentotaxman.com/ though it only goes back to 2000.
MaxGhenis#
We've also built an open-source tax and benefit calculator for the UK, which also lets you simulate custom policy reforms: https://policyengine.org/uk
nly3 replies#
The thing I find interesting is Americans always claim that countries with socialised healthcare have significantly higher tax burdens, but if you compare take home salaries between say New York and London, or San Fransisco and London, they're not that far apart.

That said, in tech Americans seem to make 50%-100% more total comp on a cost of living adjusted basis doing exactly the same job...

n4r9#
> Americans always claim that countries with socialised healthcare have significantly higher tax burdens

That's a generalisation, although some conservatives do make the claim. It's nonsense, of course: the most other developed countries including the UK spend around a third as much per person on healthcare. Another victim of poorly regulated market consolidation (among other factors).

ameister14#
Agreed. US also doesn't have VAT, though, which makes a fair bit of difference. State sales taxes vary but the highest is less than half the British VAT. Individual Income taxes are what, 25-30% of total tax revenue in the UK? I know OECD average is 25%. It's about 42% in the US.
petercooper#
The other thing that's interesting is if you ignore private payments to healthcare entirely, the US still spends more per capita from the public purse on healthcare than the UK does. So the US pays a ton of public money and yet most of the population still gets nothing unless they pay even more.
emmelaich1 reply#
I wonder whether it would be easier to get Fortran in the browser with f2c (http://www.netlib.org/f2c/) then C to WASM.

I had excellent results with f2c on an old Fortran program when I used it.

tmm1#
Thanks for sharing this! I tried it and indeed it works quite well.

This will be much simpler/easier than gfortran+dragonegg, and removes some roadblocks preventing me from using the latest emscripten/llvm.

madsbuch#
As a Danish person, it is a fun tool to play around with! Discovering that the tax difference between the US and Denmark is close to negligible is interesting as we have been known to have a high tax burden in Denmark.

Load more comments