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
refurb#
Didn’t take a close look but the 1986 (?) tax code update close major tax avoidance pathways (passive loses and tax shelters in wiki link).

I think one issue with calculators like this is it doesn’t account for excluding revenue that now has to be included.
https://en.m.wikipedia.org/wiki/Tax_Reform_Act_of_1986

interblag#
Bit late to the party but I just wanted to put one top level comment saying: this is awesome! I'd never have thought that putting a Fortran codebase like this into WASM was so possible. And doing so in this way surfaces great, battle-tested information, that would be herculean to reimplement and test in another language. Really awesome stuff!
lettergram1 reply#
The tax is not accurate historically, for higher income brackets. Prior to 2018(?) you could deduct the majority of your state income tax from the federal income tax (the "Trump tax cuts").

https://nypost.com/2021/10/05/court-upholds-trump-law-limiti...
Basically, prior to that implementation, you were really paying MAX(federal income tax, state income tax). After that implementation, you could only deduct a maximum of $10,000 in state income tax from federal tax. So it looks more like: ADD(federal income tax - $10,000, state income tax)

mrunkel1 reply#
I don't believe you're calculating the pre law change correctly.

You could deduct your state tax from your income for federal tax purposes. So if you made 100k and paid 17k in state taxes, your federal AGI was 83k. Post change, it would have been 90k.
The Trump era change was really a fuck you to high earners in states with high taxes. Shockingly, a majority of those people tended to vote for the Democratic Party.

thelamest#
Funnily enough, that SALT deduction was disliked by economists, as regressive, inefficient and mostly pointless. It was bashed by policy think tanks from all sides, e.g. Brookings, CRFB, Heritage, CBPP, and Center for American Progress.
novok#
Is there an option to add some cities or counties, like new york city's local tax?

Load more comments