Short term capital gains are basically taxed at ordinary incometax rates, meaning that your short term gains would simply be added to your other ordinary income for the year, and you would pay the appropriate taxes on your total income, based on the tax bracket that you are in.

So as an example, say you held a stock for 6 months and sold it for a gain of $1,500. If you also had a regular job and had earnings reported to you on a W-2form for $30,000, then your total ordinary income for the year would be $31,500. You would then apply your standard deduction amount and your personal exemptions allowances, and the balance would be your taxable income. You would pay taxes on this amount at ordinary rates based on your filing status (single or married, etc.) and the appropriate tax bracket that you fall into. The same would apply if you had a short term capital loss. In the same example, if you held a stock for 6 months and sold it for a loss of $1,500, then your total ordinary income for the year would be $28,500 (your salary less the $1,500 loss).

Long term capital gains have their own special tax rates which are figured separately from the tax you owe on your ordinary income. Currently the maximum amount you would pay on a long-term capital gain is 15%, and some of your gains may even qualify for zero% tax. When you report your long-term capital gains using Schedule D, there is a worksheet that helps you to calculate the tax due.

If you have both long term gains and long term losses in the same year, then you would first use your losses to offset any gains that you had, however, your net loss from the long term sales cannot exceed $3,000 in any one tax year. If your losses exceed that amount, you would carry those losses forward to use on future tax returns.

As an example, say you had one stock which you held for two years and sold that stock for a gain of $2,000. In that same year say you had another stock which you also held for 2 years and you sold that stock for a loss of $6,000. You would take your long-term capital gain of $2,000, less your long-term capital loss of $6,000, leaving you with a net loss of $4,000. Your loss limit for any one year is $3,000, so that is the amount of the loss you would report. The remaining $1,000 loss would be saved and applied to the following year's tax return.

If you ended up the year with a taxable long term capital gain, then the tax on that gain would be calculated using the worksheet provided with Schedule D. But basically, the way it works is as follows:

If your taxable income (income from wages, short term gains, etc.) including your long-term capital gains is below the level on which you would pay at the 25% rate, ignoring the fact that some of your income is capital gains, then your tax on the long term capital gains would qualify for the zero% tax. Once your taxable income falls into the 25% range, then the portion of your taxable income from the long-term capital gains is taxed at a flat 15%.

This is confusing, so I will try to give you an example to help explain how this works.

Let’s assume you are married and filing a joint return and you decide to sell a stock that you have owned for the past five years, and your gain on that stock is $20,000. Let's also assume that you and your husband had regular earnings of $32,000 each from your employment. This would give you a total income for the year of $84,000.

As a married taxpayer, you would be allowed a standard deduction of $10,900 and you would each be allowed a personal exemption amount of $3,500, leaving you with a taxable income of $66,100. Of this amount, $20,000 is eligible to be taxed at the long-term capital gains rates and the rest is taxed as ordinary income tax rates.

Below are the tax brackets for the 2008 tax year for couples filing as married:

10% on the income between $0 and $16,050

15% on the income between $16,050 and $65,100; plus $1,605.00

25% on the income between $65,100 and $131,450; plus $8,962.50

28% on the income between $131,450 and $200,300; plus $25,550.00

33% on the income between $200,300 and $357,700; plus $44,828.00

35% on the income over $357,700; plus $96,770.00

These are the rates that are charged on ordinary income and not on capital gains, BUT the same brackets are used to determine how much of your capital gains qualifies for the zero% rate.

As you can see from the above table, any ordinary taxable income which you would have that was $65,100 or less would still have 15% as the top tax bracket. In your case, your total taxable income is $46,100 from ordinary income and $20,000 from long term capital gains. The $46,100 of ordinary income would be taxed at the rates shown in the above table. You then still have a "cushion" of $19,000 before any more of your "ordinary income" spilled over into the 25% tax bracket. ($65,100 maximum 15% bracket limit less $46,100). That means that you can apply that $19,000 to the first part of your long-term capital gains, and that $19,000 would qualify for zero% tax. The remaining portion of your long-term capital gains ($1,000) is then taxed at a flat rate of 15%.

This information is based on the current tax rules and rates for the year 2008. These rates have changed historically and will likely continue to do so in future years.