How are capital gains calculated when selling stock purchased on multiple dates?
So I've been consistently investing in VOO (Vanguard S&P 500 ETF) over the past few years, adding shares whenever I can. Now I'm in a situation where I need to sell some of these shares, but I'm confused about how the capital gains tax will work. Some of my shares were purchased as recently as last month, while others I've held for several years (definitely longer than the one-year mark for long-term capital gains). How does the IRS determine which shares are being sold? Do I have a say in selecting which specific shares get sold to maximize the long-term capital gains treatment? Or does it automatically follow some kind of first-in-first-out method? I'm trying to be strategic about this to minimize my tax burden, but I'm not sure what options I have or how it works when you've bought the same stock/ETF multiple times over many years.
27 comments


Sofia Gutierrez
When selling partial positions of stock purchased at different times, you actually have several options for identifying which shares you're selling, and this directly impacts your capital gains tax treatment. By default, most brokerages use the "First In, First Out" (FIFO) method, meaning your oldest shares get sold first. But you generally have other options: Specific identification: This gives you the most control. You can specifically identify which shares you want to sell. Most brokerages allow you to select the exact lots you want to sell at the time of the sale. Average cost: Commonly used for mutual funds, this calculates an average cost basis across all your holdings. Last In, First Out (LIFO): Sells your newest shares first. The key is that you need to specify your preference at the time of the sale - you can't go back after the fact and cherry-pick which shares you sold. Your brokerage platform should have options for selecting specific lots when placing a sell order. If you're trying to minimize taxes, you might consider selling shares with the smallest gains or even shares with losses to offset other gains.
0 coins
Dmitry Petrov
•Thanks for the detailed response. Does this mean I need to contact my broker directly to specify which lots I want to sell, or is this something I can usually do myself through their online platform? Also, is the default FIFO method applied if I don't specify anything?
0 coins
Sofia Gutierrez
•Most modern brokerage platforms allow you to select specific lots yourself through their online trading interface. When you place a sell order, look for options like "Select Tax Lots" or "Specify Shares" - it's typically available before you confirm the trade. The exact wording varies by broker. Yes, if you don't specify which shares you want to sell, the default method is typically FIFO (First In, First Out), though some brokerages may have different defaults. You can usually check or change your default cost basis method in your account settings. I'd recommend looking at your specific broker's help section about "cost basis selection" or "lot selection" for the exact steps.
0 coins
StarSurfer
I just wanted to share my experience using taxr.ai to handle a similar situation with my stock sales last year. I had been buying shares of different ETFs over several years and was totally confused about capital gains calculations when I needed to sell some for a home purchase. I uploaded my brokerage statements to https://taxr.ai and it automatically organized all my purchase dates and identified the most tax-efficient selling strategy. It showed me exactly which lots would be taxed as long-term vs short-term and calculated the tax impact of different selling approaches. Saved me from accidentally triggering a bunch of short-term capital gains and showed me how to properly document my specific identification method for the IRS.
0 coins
Ava Martinez
•How does it work with multiple brokerages? I have accounts with both Fidelity and Vanguard and tracking everything across both has been a nightmare.
0 coins
Miguel Castro
•Did you have to manually enter all your transactions or does it actually pull the data automatically? I've got hundreds of purchases over the years and the thought of entering all that data makes me want to just accept whatever tax hit comes my way.
0 coins
StarSurfer
•It works great with multiple brokerages! I had accounts with Schwab and Robinhood, and I just uploaded statements from both. The system reconciled everything and gave me a consolidated view of my holdings across accounts. For transaction imports, it can directly connect to most major brokerages to pull your data automatically. I didn't have to manually enter anything - just authenticated my accounts through their secure connection and it imported several years of transaction history. For brokerages without direct connections, you can upload CSV files or statements and it extracts the data automatically. Saved me hours of spreadsheet work!
0 coins
Miguel Castro
Just wanted to follow up about my experience with taxr.ai after trying it out. I was skeptical about how well it would handle my complicated situation (over 200 VOO purchases across 5 years), but I'm genuinely impressed! The system automatically imported all my transactions and immediately showed me which lots were long-term vs short-term. The tax optimizer tool showed me I could save almost $3,200 in taxes by selling specific lots rather than using the default FIFO method my broker had set. It also generated the documentation I needed to properly report the specific identification method on my tax return. What really helped was seeing the visualization of my purchase history with the corresponding tax implications. Made it super clear which shares to sell and which to hold. Wish I'd known about this tool years ago!
0 coins
Zainab Abdulrahman
For anyone struggling to get through to the IRS about capital gains tax questions (like I was), I found a service called Claimyr that helped me get answers directly from an IRS agent without waiting on hold for hours. After three failed attempts to reach someone at the IRS about my specific stock sale situation, I tried https://claimyr.com and watched their demo at https://youtu.be/_kiP6q8DX5c. Basically, they wait on hold with the IRS for you and call you when an agent is actually on the line. I was skeptical but desperate after spending my entire Saturday morning on hold. Got a call back within 2 hours with an actual IRS agent on the line who cleared up my questions about documenting specific lot sales on my tax return. Completely changed my approach to dealing with the IRS.
0 coins
Connor Byrne
•How does that even work? Do they just call the IRS and then somehow transfer the call to you? I find it hard to believe the IRS would be okay with a third party service like that.
0 coins
Yara Elias
•Sounds too good to be true. I've spent DAYS trying to get through to the IRS about capital gains issues. What's the catch? How much does this service cost? There's gotta be a downside.
0 coins
Zainab Abdulrahman
•They use a call system that maintains your place in line and then connects you when an agent answers. It's not a transfer - they're just holding your spot in the queue. When an agent answers, their system calls you and connects the calls together. The IRS doesn't even know a service was involved - to them, it's just a regular call. There's no catch - it just solves the hold time problem. I was also skeptical before using it! The system just monitors the hold music and waits for a human voice, then immediately calls you. What impressed me was how quickly I got through compared to my previous attempts. They don't answer questions for you or anything like that - they just solve the hold time problem so you can talk directly with the IRS yourself.
0 coins
Yara Elias
I have to admit I was completely wrong about Claimyr. After responding skeptically to the comment above, I decided to try it myself since I've been unsuccessfully trying to reach the IRS about stock basis reporting requirements for weeks. The service actually worked exactly as described. I entered my phone number on their website, and about 90 minutes later (while I was at my kid's soccer game), I got a call connecting me directly to an IRS representative. I asked all my questions about reporting specific identification of stock lots and got clear answers that resolved my confusion. Previous attempts had me waiting on hold for 3+ hours before giving up. This saved me so much time and frustration - I'm actually going to file my taxes correctly now instead of just guessing and hoping for the best. Sometimes skepticism is warranted, but this service delivered exactly what it promised.
0 coins
QuantumQuasar
I'm surprised nobody has mentioned the "Highest Cost" method as another option. My accountant advised me to use this for selling some of my VOO shares last year, which let me sell the shares I paid the most for first, resulting in the least amount of capital gains (or even some losses). Most brokers offer this as an option alongside FIFO and LIFO.
0 coins
Keisha Jackson
•Does this strategy still work if some of your highest cost shares were purchased less than a year ago? Wouldn't you end up paying the higher short-term capital gains rate?
0 coins
QuantumQuasar
•You've identified the key tradeoff with the highest cost method. Yes, if your highest cost shares are recent purchases (under one year), you would potentially be looking at short-term capital gains rates, which are higher than long-term rates. This is where tax planning gets strategic. Sometimes taking a smaller gain at short-term rates is still better than taking a larger gain at long-term rates. It depends on your overall tax situation. For example, if your highest cost shares are actually at a loss or tiny gain, the short-term vs long-term distinction matters less. There's also the consideration of harvesting losses to offset other gains.
0 coins
Paolo Moretti
Anyone have experience reporting this on your tax forms? I sold some VTI last year and tried to use specific identification, but I'm confused about how to properly document this on my return. My broker sent a 1099-B but it just shows the total proceeds and doesn't specify which lots were sold.
0 coins
Amina Diop
•Your 1099-B should have detailed information about each sale, including date acquired and cost basis. If you're using tax software, you'll need to enter each lot separately rather than just the summary. If your broker didn't properly report the cost basis to the IRS, you'll need to file Form 8949 with your detailed records of which specific shares were sold. I learned this the hard way after getting a notice from the IRS. Make sure to keep all your transaction confirmations showing which specific lots you sold!
0 coins
Zara Mirza
Great discussion here! I've been dealing with a similar situation and wanted to add a few practical tips from my experience: 1. **Check your broker's default settings** - Many people don't realize their brokerage account has a default cost basis method that applies to all sales unless you specify otherwise. You can usually change this in your account settings under "Cost Basis" or "Tax Settings." 2. **Keep detailed records** - Even if your broker tracks everything, maintain your own spreadsheet with purchase dates, amounts, and prices. This becomes crucial if you ever switch brokers or need to reconstruct your basis. 3. **Consider wash sale rules** - If you're selling at a loss and planning to repurchase the same or substantially identical securities within 30 days, the wash sale rule could disallow your loss deduction. 4. **Year-end planning** - December is a great time to review your holdings and potentially harvest losses or strategically realize gains to optimize your tax situation for the year. The specific identification method really is powerful for tax optimization, but it requires being proactive at the time of sale. You can't go back later and say "I meant to sell the high-cost shares." Make sure to save confirmation emails or screenshots showing which lots you selected!
0 coins
Levi Parker
•This is incredibly helpful, especially the point about checking broker default settings! I had no idea that was even a thing. I've been using Schwab for years and just assumed they would ask me which shares to sell each time, but I bet they've been using FIFO this whole time without me realizing it. The wash sale rule tip is also something I hadn't considered - I was actually thinking about selling some of my underperforming positions and then buying them back after the market dips more. Good thing I saw this before making that mistake! Do you happen to know if the 30-day rule applies to both before AND after the sale, or just after?
0 coins
Max Reyes
•The wash sale rule applies both 30 days before AND 30 days after the sale - so it's actually a 61-day window total! If you buy the same security within 30 days before or after selling it at a loss, the loss gets disallowed. For example, if you sell VOO at a loss on January 15th, you can't buy VOO again until February 15th (30 days later) if you want to claim that loss. But it also means if you bought VOO on December 20th and then sell it at a loss on January 10th, that loss would also be disallowed because the purchase was within 30 days before the sale. The tricky part is that "substantially identical securities" can include similar ETFs. So selling VOO and buying VTI might still trigger the wash sale rule since they're both broad market index funds, though this gets into a gray area that you'd want to discuss with a tax professional. Definitely check those Schwab default settings! Most people are surprised to learn they've been using FIFO without realizing it.
0 coins
Mateo Warren
One thing I wish I'd known earlier is that you can actually set up your brokerage account to automatically use the most tax-efficient lot selection method. Most major brokers like Fidelity, Vanguard, and Schwab offer something called "Tax-Optimized" or "Tax-Efficient" as a default cost basis method. This setting will automatically try to minimize your tax liability by selling shares with the highest cost basis first (to minimize gains) or selling shares with losses to offset other gains you might have. It's not as precise as manually selecting specific lots every time, but it's a huge improvement over the basic FIFO method and saves you from having to remember to make the selection with every trade. You can usually find this setting under "Account Settings" → "Cost Basis Method" or "Tax Settings." I switched to this method last year and it's made my tax planning much simpler while still optimizing my capital gains treatment. Just make sure to review what it's doing periodically to ensure it aligns with your overall tax strategy.
0 coins
Skylar Neal
•This is exactly what I needed to know! I've been manually selecting lots for every trade and it's been exhausting trying to remember which strategy to use each time. The tax-optimized setting sounds like a perfect middle ground between the basic FIFO method and having to micromanage every single transaction. Do you know if this automatic tax-efficient method takes into account the long-term vs short-term capital gains timing? Like, will it prioritize selling long-term holdings over short-term ones even if the short-term shares have a higher cost basis? I'm trying to avoid short-term capital gains as much as possible since I'm in a higher tax bracket this year.
0 coins
Gianni Serpent
•Great question about the long-term vs short-term prioritization! Most tax-optimized methods do consider the holding period, but the exact algorithm varies by broker. Generally, they'll try to balance minimizing gains with maximizing long-term capital gains treatment. From my experience with Fidelity's tax-optimized method, it tends to prioritize this way: 1) Shares held at a loss (regardless of holding period, since losses offset gains), 2) Long-term shares with smallest gains, 3) Short-term shares only if necessary. But you should definitely check with your specific broker about their methodology. That said, if you're in a high tax bracket and want to completely avoid short-term gains, you might still want to manually select lots for larger trades or set up alerts when you're selling positions that include recent purchases. The automatic method is great for simplifying routine rebalancing, but for major sales where the tax impact is significant, manual selection gives you more control. You can always change the method back to "specific identification" for individual trades even if your account default is set to tax-optimized.
0 coins
Kennedy Morrison
This thread has been incredibly helpful! I'm in a similar situation with my VXUS holdings and want to add one more consideration that hasn't been mentioned yet - the impact of dividend reinvestment on your cost basis calculations. If you've been automatically reinvesting dividends (which most people do with ETFs like VOO), each dividend reinvestment creates a new tax lot with its own purchase date and cost basis. This can significantly complicate your specific identification strategy because you might have dozens of tiny lots from dividend reinvestments mixed in with your regular purchases. The good news is that most brokers handle this automatically when you're selecting lots to sell, but it's worth being aware of. I discovered I had over 40 different tax lots for a single ETF position because of years of quarterly dividend reinvestments! When using specific identification, make sure your broker is showing you ALL lots, including the dividend reinvestment ones, so you can make the most tax-efficient choice. Also, for anyone using the tax-optimized automatic methods mentioned above, these typically handle dividend reinvestment lots intelligently as part of their algorithm, which is another reason they can be so helpful for complex positions.
0 coins
Liam Fitzgerald
•This is such an important point about dividend reinvestment! I had no idea that each dividend creates a separate tax lot. I've been reinvesting dividends in my SCHD and VYM positions for about 3 years now, so I probably have a ton of these micro-lots that I'm completely unaware of. This actually explains why my brokerage statement looks so complicated when I try to view my cost basis details. I thought it was just a display issue, but now I realize each of those tiny entries represents a separate dividend reinvestment purchase. Does this mean I should consider turning off automatic dividend reinvestment to keep things simpler? Or are the tax benefits of having more lots to choose from worth the added complexity? I'm wondering if having all these small dividend reinvestment lots actually gives me more flexibility when it comes to tax-loss harvesting and specific identification strategies.
0 coins
Sean Doyle
•Having more lots from dividend reinvestment actually gives you MORE flexibility, not less! Each dividend reinvestment creates a separate cost basis, and over time some of these might be at gains while others could be at losses (depending on when the dividends were reinvested relative to market movements). I wouldn't recommend turning off dividend reinvestment just to simplify tax reporting. The compounding effect of reinvesting dividends is too valuable to give up for administrative convenience. Plus, most modern brokerage platforms and tax software handle these multiple lots automatically. The real benefit comes during tax-loss harvesting season or when you need to strategically realize gains. Having dozens of small lots gives you much more granular control over your tax liability. For example, you might be able to sell just the dividend reinvestment lots that are at a loss while keeping your main purchases that have larger gains. If you're using a tax-optimized cost basis method or tools like the ones mentioned earlier in this thread, they'll automatically factor in all these dividend lots when determining the most tax-efficient shares to sell. The complexity is mostly behind the scenes - you get the benefit without having to manually track everything.
0 coins