Import Brokerage History and Get True Cost Basis
By MALI ·

To find the cost basis of a stock you own, start from your purchase records, not the gain figure on your broker's position screen. Basis is generally what you paid plus costs such as commissions, adjusted afterwards for events like splits, spin-offs and wash sales. The most reliable way to rebuild it is to export your full transaction history from each brokerage, turn every purchase into its own tax lot, and then apply the corporate actions and fill the gaps the export doesn't cover.
This article covers US federal rules for individual taxable accounts. It's educational, not tax advice. It's part of the routine in portfolio management for self-directed investors.
What cost basis is, and why it drifts
The IRS's basic rule, in Topic 703 and Publication 550, is that the basis of stock you buy is the purchase price plus costs such as commissions and transfer fees. That's the starting point. After the purchase, the basis must be adjusted for events such as:
- Stock splits and stock dividends. Total basis stays the same and is spread across more (or fewer) shares.
- Spin-offs. Part of the parent's basis moves to the new company's shares, in the proportion the parent reports.
- Nondividend distributions (return of capital), which reduce basis.
- Wash sales. A disallowed loss is added to the basis of the replacement shares.
- Reinvested dividends. Each reinvestment is a new purchase with its own basis.
A broker's screen often shows a single average cost per position. That number may be right for display, but it isn't how basis works for individual stocks: each purchase is a separate tax lot with its own date and cost, and the lot you sell decides your gain and whether it's short- or long-term. Tax lots: FIFO vs specific identification covers that choice.
Covered and noncovered shares
Brokers report cost basis to the IRS on Form 1099-B, but only for "covered" securities. Under the Instructions for Form 1099-B, stock acquired for cash in an account after 2010 is generally covered, and stock eligible for the average basis method (mutual fund shares and dividend reinvestment plan shares) is covered when acquired after 2011. Shares bought earlier are "noncovered": the broker may show a basis, but it isn't required to report one, and it may not have one at all.
When covered shares move between brokers, the old broker must send the new one a transfer statement carrying the basis, within 15 days after settlement of the transfer. Noncovered shares often arrive with basis missing or marked unknown. Those are the lots you'll need to fill from your own records.
A five-step process
1. Export the full history from every account
Download the transaction history, not the current positions, for every account that ever held the security. Go back to the first purchase. If an account was closed or transferred, the old statements and trade confirmations are your source. Formats differ: Schwab, Fidelity, Vanguard and Robinhood offer CSV history exports, and Interactive Brokers provides activity statements and Flex queries.
2. Turn each purchase into a lot
Each buy becomes a lot: symbol, date, shares, price, and fees. Add the purchase commission to the lot's cost, as Topic 703 describes. Sales close lots; which lots they close depends on the identification method in force when you sold.
3. Apply splits and spin-offs
Check that the share count you rebuild matches what the broker shows today. If it doesn't, a split, reverse split or spin-off is usually the reason. A split changes basis per share but not in total. A spin-off moves part of the basis to new shares using the allocation in the company's Form 8937. How splits and spin-offs change cost basis works through both.
4. Fill the noncovered lots
For lots the broker can't report, use trade confirmations, old statements or the records of whoever bought the shares. Gifts and inheritances follow different rules: Topic 703 points to Publication 551, and basis is usually the fair market value on the date of transfer or the previous owner's adjusted basis. FINRA warns that without adequate records you may have to rely on what the broker reports, or treat the basis as zero, which can mean paying more tax.
5. Reconcile with Form 1099-B
Each year, compare the basis your ledger shows for every sale with the 1099-B. Differences usually come from wash sales the broker adjusted for, noncovered lots, or a different lot-selection method. Investigate every difference before you file. Publication 550 notes that the IRS works with companies whose Form 8949 software can import trades from many brokers.
A worked example
In this illustrative example, an investor holds a hypothetical stock, Example Co., bought in two accounts.
- Lot 1. 50 shares bought in 2019 at $120 with a $5 commission: basis $6,005, or $120.10 a share. The broker that held them was later closed and the shares transferred, so they arrived at the new broker as noncovered with no basis.
- 2021. Example Co. split 2-for-1. Lot 1 became 100 shares with the same $6,005 basis, now $60.05 a share.
- Lot 2. 40 shares bought in 2024 at $75 with a $5 commission: basis $3,005, or $75.125 a share.
The broker's screen shows 140 shares with an "average cost" built only from Lot 2, because Lot 1 has no basis on file. Rebuilt from the records, the position's total basis is $9,010 ($6,005 + $3,005), and the two lots have different dates and costs.
If the investor sold the 100 Lot 1 shares at $70 and the noncovered lot were treated as zero basis, the gain would be $7,000 instead of $995 ($7,000 minus $6,005, ignoring sale costs). The old confirmation is worth finding.
Common mistakes
- Exporting positions instead of transactions. Positions give you today's share count and nothing about lots.
- Importing one account only. Lots in an old or closed account are still your lots.
- Applying a split twice. Some exports already show split-adjusted quantities; others show the split as its own row. Check the share count after import.
- Forgetting fees. Commissions add to basis; sale costs reduce the amount realized.
- Ignoring reinvested dividends. Each reinvestment is a new lot, often small, and can make part of a loss sale a wash sale.
Where MALI fits
MALI's portfolio tracker imports files exported from Charles Schwab, Fidelity, Vanguard, Robinhood and Interactive Brokers (activity statement or Flex query). It recognizes the format from the header and previews every row before saving, marked new, already imported or possible duplicate. Each buy becomes a tax lot with its fee included in cost, and splits in the file are applied to earlier purchases. You record a spin-off or a split the file doesn't carry by hand, with the cost split from the company's Form 8937.
Limits: there's no live broker connection, only files you export (up to 5,000 rows). Cash dividends, interest, transfers and options in a file are listed and skipped. Tax views are estimates, not tax advice. Once the ledger is right, the Portfolio Advisor runs its seven rule-based checks on what you actually hold.
FAQ
How do I find the cost basis of a stock I bought years ago?
Start with old trade confirmations and account statements, then the broker that held the shares at the time. If the shares were transferred, the receiving broker may hold them as noncovered with no basis. Gifted or inherited shares follow different rules; see IRS Publication 551.
What is the difference between covered and noncovered securities?
Covered securities are those whose basis brokers must report to the IRS on Form 1099-B, generally stock acquired after 2010 and fund or reinvestment-plan shares acquired after 2011. For noncovered shares, keeping the basis record is up to you.
Is the average cost on my broker's screen my tax basis?
Not necessarily. For individual stocks, each purchase is a separate lot, and gains are figured on the lots actually sold. Average basis is available only for certain shares, such as mutual fund and dividend reinvestment plan shares.
Do commissions count toward cost basis?
Yes. IRS Topic 703 says basis is the purchase price plus costs such as commissions and transfer fees.
Sources
- Topic no. 703, Basis of assets, IRS
- Publication 550 (2025), Investment Income and Expenses, IRS
- Instructions for Form 1099-B, IRS
- Cost Basis Basics, FINRA
This article is educational and is not investment advice. MALI is a research and analytics platform; it does not recommend buying or selling any security.
