First-In, First-Out Method in content page of articles
This is the default method to determine shares you sold if both of the following apply:
You held your shares in a brokerage account.
You didn't specify a method when you sold your shares.
With the first-in, first-out method, the shares you sell are the first ones you bought. Since the market usually goes up over time, you'll get a bigger gain by selling shares you bought using the first-in, first-out method. If you've held the shares for various lengths of time, you might get favorable long-term capital gains treatment by selling the one you bought first.
If you want to sell shares other than the ones you bought first, you must specifically identify those shares in writing before the sale. The broker must also send you a confirmation that those shares will be sold.