When you decide to sell a portion of your holdings in a stock, you have to decide which shares you actually want to sell. Two of the most common methods used in this decision are known as FIFO and LIFO, and the choice you make can have a big impact on your taxes.

What FIFO and LIFO mean
FIFO and LIFO are acronyms that in this case relate to the stock you decide to sell. FIFO stands for first in, first out, while LIFO stands for last in, first out. What this means is that if you use the FIFO method, then a sale of stock will be allocated to the shares you bought earliest. The LIFO method, conversely, involves selling the shares you bought most recently.

Which method is better?
Both methods have their advantages and disadvantages. The FIFO method is the default for the IRS, and so if you don't specify a method with your broker when you sell shares, you'll automatically be treated as if you had elected FIFO treatment. The main benefit of the FIFO method is that by using the shares you acquired first, you're more likely to get long-term capital gains treatment for any profits that you earn. The disadvantage of the FIFO method, however, is that because stock prices tend to rise over time, the shares you bought first will typically have the lowest cost basis. That means that your taxable gain could be higher than it would be on other shares you've owned for a shorter period of time.

The LIFO method is one that you have to elect affirmatively with your broker. The main benefit of the LIFO method is that the shares that you've owned for the shortest period of time tend to be the ones that have the smallest taxable gain, and so you can make a sale without incurring a large tax bill. However, because the LIFO method involves the shares that you bought most recently, any tax that does result will sometimes be taxed at higher short-term capital gains rates.

The key to either method is ensuring that you receive written confirmation from your broker that verifies the use of the correct method. If your broker doesn't send that information, then the IRS can conclude that you never made an election and so force you to use the default FIFO method.

Being tax-smart about selling shares is important in order to maximize your after-tax returns. By choosing wisely between FIFO and LIFO when selling stock, you can manage your taxes more effectively and keep more of your profits for yourself.

This article is part of The Motley Fool's Knowledge Center, which was created based on the collected wisdom of a fantastic community of investors. We'd love to hear your questions, thoughts, and opinions on the Knowledge Center in general or this page in particular. Your input will help us help the world invest, better! Email us at knowledgecenter@fool.com. Thanks -- and Fool on!

Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.