Back to IRS

Carter Holmes

Calculating cost basis for stocks bought and sold over multiple transactions - FIFO vs average cost method confusion

This is my first time dealing with taxes on my stock trades and I'm totally confused about how to calculate the profit/loss correctly. I'm especially stuck on figuring out the cost basis for stocks I've purchased multiple times. For simple cases, I get it. Like if I bought 10 shares of Tesla at $130 each and sold 8 shares later at $195, my cost basis would be $1,040 and my profit would be $520 (8 × $65). Then I'd pay either short or long-term capital gains depending on my holding period. But here's where I'm lost: I bought 5 shares of Amazon at $130, then another 10 shares at $195 a week later. Then I sold 8 shares at $260 after holding for a while. Should I use the average purchase price for my cost basis, which would be 8 shares × ((5 × $130 + 10 × $195)/15) = $1,387? Or do I use FIFO, which would be (5 × $130) + (3 × $195) = $1,235? My broker didn't include the cost basis on the 1099-B they sent me, but they did provide a list of all my transactions. Now I'm manually calculating everything. Am I allowed to choose whichever method gives me the lower taxable profit (FIFO in this example), or does the IRS require a specific method? I've been searching online but can't find a clear answer. Any help would be really appreciated!

The IRS generally expects you to use the FIFO (First-In, First-Out) method unless you specifically identify which shares you're selling at the time of sale. This means your oldest shares are sold first. In your Amazon example, using FIFO would be correct: first the 5 shares at $130 ($650), then 3 of the shares at $195 ($585), for a total cost basis of $1,235. Your gain would be $2,080 (sale price) - $1,235 (cost basis) = $845. If you want to use a different method like specific identification (which can be more tax advantageous), you need to tell your broker specifically which shares to sell at the time of the transaction. After the fact, you're generally stuck with FIFO. For future reference, most brokers can be set up to track this automatically. When you have them include the cost basis on your 1099-B, it saves a ton of headache. Since you're doing it manually this year, make sure to keep detailed records of your calculations in case of an audit.

0 coins

Thanks for clarifying! So just to make sure I understand correctly, since I didn't specify which shares I was selling at the time, I have to use FIFO? There's no way to use the average cost method? Also, do you know how I would report this on my tax forms? Do I just put the total gain on Schedule D, or do I need to break it down somehow?

0 coins

You're correct - since you didn't specify which shares at the time of sale, you'll need to use FIFO. The average cost method is only allowed for mutual funds and certain dividend reinvestment plans, not for individual stocks. For reporting, you'll list each sale on Form 8949. Since your 1099-B doesn't include cost basis, you'll check Box C (short-term) or Box F (long-term) at the top of the form. List each sale transaction, including dates acquired, dates sold, proceeds, and your calculated cost basis. Then transfer the totals to Schedule D. Make sure to keep all your transaction records and calculations in case the IRS has questions.

0 coins

After spending hours trying to manually calculate my stock gains last year, I found taxr.ai (https://taxr.ai) and it completely changed my tax preparation experience. It automatically analyzes all your trading history, applies the correct cost basis method, and even optimizes your tax situation where allowed. I had 50+ trades with partial buys and sells across multiple brokers last year, and was spending days trying to reconcile everything. Taxr.ai imported my trading history, showed me which method (FIFO, LIFO, or specific ID) was best for each situation, and generated all the forms I needed. The time saved was incredible.

0 coins

Does taxr.ai work with crypto transactions too? I've got both stocks and crypto and the crypto part is especially confusing with all the different exchanges.

0 coins

How accurate is it compared to the paid tax software packages? I've been using TurboTax but it's getting expensive and doesn't handle complex stock situations well without upgrading to their premium package.

0 coins

Yes, taxr.ai absolutely works with crypto transactions! It supports imports from all major crypto exchanges and can handle even complex situations like staking rewards, mining income, and token swaps. It applies the same FIFO/LIFO logic to crypto transactions and even accounts for wash sale rules when applicable. For accuracy, I found it more detailed than TurboTax for investment situations. It breaks down each transaction with far more granularity than TurboTax's basic investment module. The best part is that it shows you exactly how it calculated everything, so you can verify the math. I actually found a mistake in my previous year's TurboTax calculations after using taxr.ai and had to file an amendment to get money back.

0 coins

I wanted to follow up about taxr.ai since I gave it a try after seeing it mentioned here. Wow, what a difference! I was struggling with exactly the same issue as the original poster - multiple stock purchases at different prices and trying to figure out the right cost basis method. The platform instantly identified which transactions would benefit from FIFO vs specific identification, showing me side-by-side comparisons of my tax liability under different scenarios. It saved me over $400 in taxes by optimizing which lots to sell first! Plus, it generated the perfect Form 8949 that I could just attach to my return. For anyone dealing with investment taxes, especially with missing cost basis info from brokers, this tool is a game changer. I'm definitely not going back to my old spreadsheet method.

0 coins

If you're having trouble reaching the IRS for clarification on cost basis methods (I tried calling them 6 times last tax season), try Claimyr (https://claimyr.com). They solved my IRS connection problems. Watch how it works: https://youtu.be/_kiP6q8DX5c I had a similar cost basis issue last year with some employee stock options where the reported basis was clearly wrong. After waiting on hold for hours with the IRS multiple times and getting disconnected, I found Claimyr. They got me connected to an actual IRS agent in about 20 minutes who explained exactly how to report my specific situation and which forms I needed.

0 coins

How does this actually work? Does it just call the IRS for you? Couldn't I just keep calling myself until I get through?

0 coins

This sounds like a scam. You're telling me some random service can magically get through to the IRS when millions of people can't? Yeah right. The IRS phone system is broken by design and no app is going to fix that.

0 coins

It doesn't just call for you - they use a smart system that navigates the IRS phone tree and waits on hold in your place. When they reach a live agent, you get a call back to connect with the agent. It's entirely different from just calling repeatedly yourself because their system is optimized to work with the IRS phone system patterns. I was skeptical too until I tried it. The difference is they have technology that keeps your place in line even during disconnects and can call back at optimal times when hold times are shorter. I spent literal days trying to get through on my own before using this. It's basically like having someone wait in a physical line for you, then texting when they get to the front so you can take their place.

0 coins

I need to admit I was completely wrong about Claimyr. After posting my skeptical comment, I was desperate enough to try it when I discovered the IRS had applied my payment to the wrong tax year and I was getting automated collection notices. It actually did exactly what they claimed - I got a text when they were navigating the IRS menu system, another update when I was in the hold queue, and then a call connecting me directly to an IRS agent. Total time was about 30 minutes instead of the 3+ hours I had wasted previously. The agent fixed my payment application issue in minutes once I actually reached them. For anyone dealing with cost basis issues that need IRS clarification, this really does work for getting an actual human on the phone who can help. I'm genuinely shocked at how well it worked.

0 coins

Something nobody has mentioned yet - for stocks without reported cost basis, you should also check if you have dividend reinvestment set up. Those tiny fractional share purchases can be a pain to track but they need to be included in your cost basis calculations. The same FIFO rules apply to them, and I learned this the hard way when I got a CP2000 notice from the IRS questioning why my reported gain was lower than they calculated. I had to explain that their calculation ignored my reinvested dividends that had already been taxed!

0 coins

Oh wow, I didn't even think about dividend reinvestments! I do have DRIP turned on for some of my positions. How exactly do I account for all those tiny purchases? I must have dozens of them throughout the year at different prices.

0 coins

For dividend reinvestments, you'll need to treat each reinvestment as a separate purchase at the price on the reinvestment date. I'd recommend downloading a complete transaction history from your broker that includes all reinvestments. Then you apply the same FIFO method - if you sell shares, you sell the oldest ones first, including any fractional shares from reinvestments. If you're doing this manually, create a spreadsheet tracking each purchase (including reinvestments) with date, number of shares, and price. When you sell, start removing shares from the top of your list (oldest first) until you've accounted for all shares sold. The sum of those purchase prices becomes your cost basis. It's tedious but necessary to avoid problems with the IRS.

0 coins

Does anyone know if wash sale rules affect the cost basis calculation when using FIFO? I sold some Tesla at a loss in December and rebought in January, but now I'm selling some again and trying to figure out if my earlier loss disallowed by the wash sale should be factored into my current cost basis.

0 coins

Yes, wash sales absolutely affect your cost basis! When you have a wash sale (selling at a loss and buying substantially identical securities within 30 days before or after), the disallowed loss amount gets added to the cost basis of the replacement shares. So if you sold Tesla at a $500 loss in December and bought back in January, that $500 loss gets added to the cost basis of your January purchase. When you eventually sell those shares, your higher cost basis will reduce your taxable gain (or increase your loss).

0 coins

Just wanted to add a practical tip for anyone manually calculating cost basis - create a separate "lot tracking" sheet in Excel or Google Sheets with columns for Date Purchased, Shares, Price Per Share, and Total Cost. Then when you sell, use another sheet to track which lots you're selling from (oldest first for FIFO). I also recommend keeping screenshots or PDFs of your broker's transaction history as backup documentation. I learned this lesson when my broker's website was down during tax season and I couldn't access my transaction details. Having those records saved locally made all the difference when my CPA needed to verify my calculations. One more thing - if you're dealing with stock splits or spinoffs, those events can complicate your cost basis calculations significantly. The IRS has specific rules about how to allocate your original cost basis across the new shares, so don't forget to account for those if applicable.

0 coins

Great discussion everyone! As someone who went through this exact same confusion last year, I wanted to add that if you're feeling overwhelmed by the manual calculations, don't hesitate to consult a tax professional for this first year. I spent weeks trying to figure out my cost basis calculations and ended up paying a CPA $200 to review my work - best money I ever spent for peace of mind. The CPA caught several errors in my manual calculations, including some dividend reinvestments I had missed and a stock split adjustment I had calculated incorrectly. More importantly, they showed me how to set up a better tracking system for next year so I won't have to go through this nightmare again. One thing I learned is that many CPAs who specialize in investment taxation offer "review only" services where they'll check your calculations without preparing your entire return. This can be a cost-effective middle ground if you want to do most of the work yourself but get professional verification on the tricky parts. Also, make sure you understand the holding period rules for determining short-term vs long-term capital gains. The calculation isn't just about cost basis - the tax rate you'll pay depends on whether you held the shares for more than a year, and this gets complicated when you're using FIFO with multiple purchase dates.

0 coins

This is such great advice about getting professional help! I'm actually in a very similar situation to the original poster - first time dealing with stock taxes and feeling completely overwhelmed by all the calculations. The point about holding periods is especially helpful because I hadn't even thought about how FIFO affects whether my gains are short-term or long-term. If I'm selling my oldest shares first, some might be long-term while others are short-term depending on when I bought them, right? I think I'm going to take your suggestion about finding a CPA who does review-only services. Do you have any tips on finding someone who specializes in investment taxation? I've been doing my own taxes with software for years, but this stock situation is way beyond what I'm comfortable handling alone. Also, did the CPA help you set up a better tracking system, or did you end up using one of the automated tools that others mentioned in this thread?

0 coins

You're absolutely right about the holding period complexity with FIFO! When you sell shares using FIFO, each portion of your sale could have a different holding period. So if you bought shares in January 2023 and March 2024, then sold some in February 2024, the January shares would be long-term but the March shares would be short-term. For finding a good CPA, I'd recommend checking with your state's CPA society for referrals to tax professionals who specialize in investments. You can also ask for recommendations on local investing forums or check if any CPAs in your area advertise investment tax specialization. My CPA actually recommended a hybrid approach - she helped me set up a proper Excel template with formulas that automatically calculate FIFO cost basis and holding periods, then suggested I try one of the automated tools mentioned here (like taxr.ai) for next year to compare results. The manual system works great as a backup and helps me understand what's happening, but the automation saves tons of time for complex situations. The review-only service cost me $150-200 but saved me from potentially costly mistakes. Plus, now I feel much more confident about handling this myself going forward.

0 coins

One thing I haven't seen mentioned yet is the importance of checking if your broker offers cost basis tracking services for a fee. After going through the manual calculation nightmare myself last year, I discovered that Fidelity offers enhanced cost basis reporting for a small annual fee that includes historical data reconstruction. They were able to go back and calculate cost basis for stocks I bought years ago, including accounting for stock splits, dividend reinvestments, and even some corporate actions I had completely forgotten about. It cost me about $75 but saved me dozens of hours and gave me confidence that everything was calculated correctly. Another tip for anyone doing this manually - don't forget about wash sales between different accounts! If you have both taxable and retirement accounts with the same broker, or accounts with different brokers, the IRS wash sale rules still apply across all of them. I learned this the hard way when I sold Tesla at a loss in my taxable account and bought it back in my Roth IRA within 30 days. For those dealing with complex situations like the merger example mentioned above, or if you have employee stock options, RSUs, or ESPP transactions mixed in with your regular trading, I'd strongly recommend getting professional help for at least the first year. The potential cost of getting it wrong far outweighs the cost of a CPA review.

0 coins

This is such valuable information about broker cost basis services! I had no idea that some brokers offered historical reconstruction for a fee. That $75 sounds like a bargain compared to the time and stress of doing it manually, especially with all the corporate actions you mentioned. Your point about wash sales across different accounts is really important too - I definitely wouldn't have thought about that! Does this mean if I have accounts with multiple brokers, I need to track wash sales manually across all of them? That sounds like it could get really complicated to monitor. Also, for anyone following this thread, I wanted to mention that I ended up trying the taxr.ai tool that @Angelica Smith recommended earlier, and it actually caught a wash sale situation I had missed in my manual calculations. It s'been a lifesaver for someone like me who s'new to investment taxes and probably would have made costly mistakes on my own. The combination of getting professional help for the first year like (you suggested plus) using better tools going forward seems like the smart approach. Thanks for sharing your experience with the Fidelity service - I m'going to look into whether my broker offers something similar!

0 coins

As a newcomer who's been lurking here trying to learn about investment taxes, this entire discussion has been incredibly valuable! I'm in almost the exact same situation as Carter - first time dealing with stock transactions on my taxes and completely confused about cost basis calculations. What really strikes me is how many different tools and approaches everyone has shared. From manual spreadsheets to automated platforms like taxr.ai, to broker services, to getting professional help - it seems like there are solutions for every comfort level and budget. I particularly appreciate the emphasis on understanding the underlying mechanics even if you use automated tools. The point about FIFO being mandatory for stocks (unless you specifically identified shares at sale time) was a key clarification I needed. I had been wondering if I could just pick whichever method gave me a lower tax bill! One question for the group: for someone just starting out with a relatively simple situation (maybe 5-10 stock transactions), would you recommend starting with the manual Publication 550 approach to learn the fundamentals, or jumping straight to one of the automated tools to avoid potential errors? I'm comfortable with spreadsheets but want to make sure I don't mess up my first year of investment taxes. Thanks to everyone who shared their experiences - this community knowledge is so much more helpful than trying to navigate IRS publications alone!

0 coins

Welcome to the community, Liam! Your situation sounds very manageable for a first-timer. With only 5-10 transactions, I'd actually recommend starting with the manual Publication 550 approach first. Here's why: 1. It'll teach you the fundamentals so you can spot-check any automated tools later 2. With that few transactions, it's totally doable in a weekend 3. You'll understand exactly how FIFO works and why certain shares get selected 4. If you make a mistake, it's easier to catch and fix with a small number of transactions Once you've worked through it manually and understand the logic, then try one of the automated tools like taxr.ai on the same data to verify your results match. That gives you the best of both worlds - education plus verification. The key things to remember for your first year: stick with FIFO since you didn't specify shares at sale time, include any dividend reinvestments as separate purchases, and keep detailed records of your calculations. Don't overthink it - the IRS just wants to see that you used a consistent, reasonable method and can support your numbers. You've got this! Start with Publication 550 and feel free to ask questions as you work through it.

0 coins

As someone new to investment taxes, this entire discussion has been incredibly educational! I'm in a similar situation with multiple stock purchases and missing cost basis information from my broker. Reading through everyone's experiences, I'm planning to take a systematic approach: start with the manual Publication 550 method to understand the FIFO mechanics, then use one of the automated tools mentioned here to verify my calculations. The point about FIFO being mandatory for stocks (unless you specified shares at sale time) was a crucial clarification I needed. One thing I'm curious about - for those who've used both manual calculations and automated tools like taxr.ai, how closely did the results match? I want to make sure I'm getting accurate numbers, especially since this is my first year dealing with investment taxes and I'm worried about making costly mistakes. Also, thanks to everyone who emphasized checking broker portals for complete transaction histories. I just logged into mine and found several dividend reinvestment records that weren't on my printed 1099-B - would have been a significant oversight if I'd missed those in my cost basis calculations!

0 coins

Great question about the accuracy comparison between manual calculations and automated tools! I actually did exactly what you're planning - worked through my transactions manually first using Publication 550, then ran the same data through taxr.ai to verify. The results were remarkably close - within a few dollars on most positions. The small differences were mainly due to rounding at different steps in the calculation, but nothing that would materially affect my tax liability. What I found most valuable was that the automated tool caught a couple of dividend reinvestments I had missed in my manual tracking, and it automatically handled a stock split adjustment that I had calculated slightly wrong. The manual process definitely helped me understand what was happening "under the hood," so when the automated tool showed slightly different numbers, I could dig in and figure out why. In most cases, the tool was actually more accurate because it had access to more precise pricing data and handled corporate actions more systematically than I did. Your approach of doing both sounds perfect for a first-timer. The manual work builds confidence and understanding, while the automated verification gives you peace of mind about accuracy. Just make sure to download that complete transaction history before you start - those dividend reinvestments really do add up and can significantly impact your cost basis calculations!

0 coins

As a newcomer to this community and investment taxes in general, I wanted to thank everyone for this incredibly detailed and helpful discussion! I'm in almost the exact same situation as Carter - first time dealing with stock transactions on my taxes and completely confused about cost basis calculations. The clarification that FIFO is mandatory for individual stocks (unless you specified shares at sale time) was crucial for me to understand. I had been hoping I could just pick whichever method gave me lower taxes, but now I see why that's not allowed. What I find most valuable about this thread is how many different approaches and tools have been shared - from manual spreadsheet tracking to automated platforms like taxr.ai, to professional CPA review services. It gives newcomers like me options based on our comfort level and complexity of our situations. I'm planning to follow the systematic approach several people recommended: start with the manual Publication 550 method to learn the fundamentals, then use an automated tool to verify my calculations. The emphasis on downloading complete transaction histories (including those easy-to-miss dividend reinvestments) before starting seems absolutely critical. One question for the group: for someone with about 15-20 stock transactions in their first year, would you still recommend the manual approach first, or at that volume should I jump straight to one of the automated tools to avoid potential calculation errors? I'm reasonably comfortable with spreadsheets but definitely want to get this right. Thanks again to this amazing community for sharing such detailed experiences and practical advice!

0 coins

Welcome to the community, Isabella! With 15-20 transactions, you're right at the threshold where either approach could work well. I'd actually still recommend starting with the manual method for a few key reasons: First, 15-20 transactions is totally manageable for a weekend project, and you'll gain invaluable understanding of how FIFO actually works. This knowledge becomes crucial when you need to verify automated tools or explain your calculations to the IRS later. Second, doing it manually first helps you catch potential data issues early. I discovered missing dividend reinvestments, incorrect stock split adjustments, and even a duplicate transaction in my broker's export when I was working through each trade individually. An automated tool might have propagated those errors without you noticing. That said, definitely use an automated tool like taxr.ai afterward to verify your manual calculations! I found small discrepancies (usually due to rounding or more precise pricing data) that helped me refine my approach. Pro tip: Start with your simplest positions first to build confidence, then tackle the more complex ones with multiple purchases and corporate actions. Create a master spreadsheet with all purchases sorted by date, then work through your sales one by one using FIFO. The time investment upfront pays huge dividends in understanding and confidence. Plus, if you ever need to reconstruct your calculations or handle an IRS inquiry, you'll know exactly how every number was derived. You've got this!

0 coins

This is such helpful advice, thank you! Your point about catching data issues during manual review is really valuable - I definitely wouldn't want an automated tool to compound errors I didn't even know existed in my transaction data. The suggestion to start with simpler positions first makes a lot of sense too. I think I have a few stocks where I only bought once and sold once, which would be perfect for building confidence before tackling the ones with multiple purchases at different prices. I'm curious about something you mentioned regarding stock split adjustments - how common are these types of corporate actions, and are they typically reflected correctly in broker transaction exports? I'm wondering if there are other types of corporate actions I should be watching for that might affect my cost basis calculations. Also, when you say "master spreadsheet with all purchases sorted by date," do you mean literally every stock purchase across all positions in one big chronological list, or separate sheets for each stock position? I want to make sure I set this up in the most efficient way from the start. Thanks for the encouragement - reading everyone's experiences here has made this feel so much more manageable than when I first started researching investment taxes!

0 coins

Great questions! Stock splits and other corporate actions are actually pretty common - I'd say about 20-30% of actively traded stocks have some kind of corporate action over a few years. The good news is that most major brokers handle splits correctly in their systems, but dividend spinoffs, mergers, and stock dividends can sometimes get messy in the export data. For the master spreadsheet approach, I actually recommend doing it by individual stock position rather than one giant chronological list. So you'd have separate tabs for each stock (AAPL, TSLA, etc.) with all the purchases for that stock sorted by date. This makes it much easier to apply FIFO when you sell - you just work down the list for that specific stock. Here's the structure I use: - Column A: Purchase Date - Column B: Shares Purchased - Column C: Price Per Share - Column D: Total Cost - Column E: Shares Remaining (updates as you sell) When you sell shares, you work from the top down, subtracting from the "Shares Remaining" column until you've accounted for all shares sold. Keep track of which lots you're selling from and their original cost basis. Other corporate actions to watch for: stock dividends (like a 5% stock dividend), spin-offs where you receive shares of a different company, and rights offerings. These all affect cost basis calculations and aren't always handled perfectly in automated exports. The manual process really does help you spot these issues that could otherwise cause problems down the road!

0 coins

As someone who's been lurking in this community trying to learn about investment taxes, this discussion has been incredibly helpful! I'm facing the exact same situation - first time dealing with stock transactions and completely overwhelmed by cost basis calculations. The clarification about FIFO being mandatory for individual stocks unless you specified shares at sale time was crucial for me to understand. I had been hoping there was some flexibility to choose the most tax-advantageous method, but now I see why the IRS has these specific rules. What I find most valuable is seeing all the different approaches shared here - from manual spreadsheet tracking using Publication 550, to automated tools like taxr.ai, to professional CPA review services. It gives newcomers like me options based on our comfort level and situation complexity. I'm planning to follow the systematic approach several people recommended: start with manual calculations to understand the FIFO mechanics, then use an automated tool to verify my work. The emphasis on downloading complete transaction histories including dividend reinvestments before starting seems absolutely critical. One thing I hadn't considered was how FIFO affects holding periods for short-term vs long-term capital gains. It sounds like a single stock sale could have portions taxed at different rates depending on the original purchase dates of the underlying shares - that adds another layer of complexity I need to wrap my head around! Thanks to everyone for sharing such detailed experiences and practical advice. This community knowledge is so much more accessible than trying to navigate IRS publications alone.

0 coins

IRS AI

Expert Assistant
Secure