Skip to content

jeff162/1099b-pdf-to-txf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Python

1099b-pdf-to-txf

A Python script that parses the 1099-B section of a consolidated 1099 PDF from supported brokers and generates a TXF (Tax Exchange Format) file for import into tax software such as H&R Block or TurboTax.

⚠️ Disclaimer

This tool is provided for informational purposes only and is not tax advice. You are responsible for verifying the accuracy of all generated data before and after importing into tax software or filing with the IRS.

Use at your own risk.


Quick Start

python 1099b_to_txf.py your_1099.pdf

This generates a .txf file that can be imported into your tax software.


Features

  • Parses consolidated 1099 PDFs from supported brokers
  • Extracts 1099-B transaction data
  • Generates TXF files compatible with tax software
  • Groups transactions using IRS-accepted VAR-S / VAR-L rules
  • Provides a terminal preview for verification before import

Supported Brokers

  • Morgan Stanley — consolidated 1099 PDF
  • Fidelity — consolidated 1099 PDF (Fidelity Brokerage Services LLC)

Additional brokers can be added by implementing a new parser and extending detect_broker().


Supported Transaction Types

  • Short-term covered securities (Box A, Form 8949 Part I)
  • Long-term covered securities (Box D, Form 8949 Part II)
    • H&R Block uses codes 321 / 323
    • TurboTax typically uses BD / BE (implemented but not fully tested)

Installation

git clone https://github.com/jeff162/1099b-pdf-to-txf.git
cd 1099b-pdf-to-txf
pip install -r requirements.txt

Requirements

  • Python 3.10+
  • pdfplumber (see requirements.txt)

Usage

python 1099b_to_txf.py <input.pdf> [output.txf] [--tt] [--swap|--no-swap]

Arguments

  • input.pdf — path to your consolidated 1099 PDF
  • output.txf — optional output file path (defaults to same name as input)
  • --tt — format output for TurboTax (default is H&R Block)
  • --swap / --no-swap — override proceeds/cost basis field order

Examples

H&R Block (default)

python 1099b_to_txf.py consolidated_1099.pdf

TurboTax

python 1099b_to_txf.py consolidated_1099.pdf --tt

Importing into H&R Block

  1. Go to File → Import Financial Information
  2. Select the generated .txf file
  3. Verify imported transactions

Importing into TurboTax

  1. Go to Federal → Wages & Income → Investment Income → Stocks, Crypto, etc.
  2. Choose I'll type it in myselfImport from TXF file
  3. Select the generated .txf file
  4. Verify imported transactions

Output Preview

The script prints a summary table to the terminal so you can verify results before importing:

Reading PDF: DownloadedData.pdf
Detected broker format: morgan_stanley
Found 146 transactions (68 short-term, 78 long-term)
Grouped into 24 TXF records
...

Short-term and long-term subtotals can be cross-checked against your 1099 summary.


Transaction Grouping

Where eligible, transactions are grouped using IRS-accepted date labels:

  • VAR-S (short-term)
  • VAR-L (long-term)

Rules

  • Lots of the same security and term are grouped
  • Wash sale ≥ $0.50 → disables grouping for that security
  • Wash sale < $0.50 → treated as zero

Compatibility Notes

Feature H&R Block (default) TurboTax (--tt)
TXF record codes 321, 323 BD, BE
Field order Cost basis first Proceeds first
  • H&R Block behavior was validated empirically
  • TurboTax support is implemented but not fully validated

Input Requirements

  • Consolidated 1099 PDF from a supported broker
  • Must include the 1099-B section
  • Should be a digital PDF (not scanned)

License

MIT License


Notes

Parts of this project were initially generated with the assistance of AI and later reviewed and refined.

About

Convert 1099-B PDFs from brokers into TXF files for H&R Block or TurboTax

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages