Skip to content


Repository files navigation

TaxStuff - basic federal tax return calculator

NOTE: work in progress, not ready to be used by anyone for anything other than their own amusement.

How hard could it be to clone TruboTax? Quite hard, given the complexity of the tax code. So this is not really user-friendly. It is about on the level of Free File Fillable Forms: it assumes you understand the tax code enough to know which forms you need to file.

I was inspired by Robert Sesek's excellent ustaxlib.


Requires .NET 5 SDK to build and run.

When you run the program, it takes two arguments: the path to the return file and a folder to put the PDFs in:

mkdir output
dotnet run --project TaxStuff/TaxStuff.csproj ExampleReturn.xml output

See example input file and example 1040 output.


  • Can import OFX tax exports (from Schwab for example), to support interest dividends, and stock transactions. The contents of the 1099-Bs will be turned into Form 8949s and will be referenced by !040 Schedule D. The 1009-DIVs and 1099-INTs will be put into the right places on Form 1040.
  • Fill in the results of tax computations into PDF tax forms.
  • A custom XML format and expression language for defining tax forms. See the 2020 folder for the forms.


I'm not really sure what to license this as right now. The dependencies has a couple of different license, which makes this more complicated.

  • iText: GNU Affero General Public License

  • ANTLR: BSD 3-clause

  • OFX XML Schema files: Just "All Rights Reserved", though the specification says

    A royalty-free, worldwide, and perpetual license is hereby granted to any party to use the Open Financial Exchange Specification to make, use, and sell products and services that conform to this Specification.

    I don't know how "conform" is evaluated.


  • Add an Assert element in forms to check for errors.
  • Unit tests probably
  • Support for references to previous years, to support things like capital loss carryover and Schedule J.
  • Support for filling in personal information into PDFs.
  • Support for filtering array values, probably using a bracket syntax. Use cases:
    • Replace the special filter function FilterForm8949 with native filitering support.
  • Similar to the above filtering, support a "group by" feature.
    • For 2020 Form 1040 Schedule 3 Line 10, it would be nice to write something like:
      FormW-2.GroupBy(f => f.SSN)
             .Select(g => Math.Max(0, g.Sum(f => f.SocialSecurityTaxWithheld) - 8537.40))
  • Clean up PDF writing
    • Leave spaces blank when appropriate instead of writing 0.
    • Round to whole dollars.
  • Somehow unify the parsing, typechecking, and evaluation representation of language semantics. Particularly EvaluationResult and ExpressionType have a similar shape.
  • Maybe instead of interpreting the expression language, it could be compiled to C# using a source generator. This might allow for the execution engine having type-safe knowledge of different forms, for the benefit of the OXF transaction importer.

Adding support for filling in PDFs

I've only done 1040, the process I'm using to find the name of the fields of the PDF to fill in is:

  1. Use the XfaForm iText API to pull out the XFA form template.
  2. Find the assistive text associated with each field. These nodes can be found with the XPath expression form/assist/speak.
  3. Record a substring of this node in the PdfInfo.xml file.

Hopefully by going by the assistive text on the PDF this mapping is a little easier to maintain than just recording the field name. The field names appear to be generated, like "f2_28".


Just some IRS tax stuff






No releases published