Although winding up with so much in capital losses that they exceed your capital gains doesn't make anyone happy, it does happen and even has a bright side (sort of). The bright side would be that capital losses that exceed the amount of capital gains for the current year can be carried forward to offset the following years capital gains until your capital losses have been used up.
Capital losses incurred in excess of capital gains can only be used to offset capital gains up to the amount of the capital gains. That means if you have $15,000 in capital losses and only $5,000 in capital gains for the year, you can only apply $5,000 of the $15,000 in losses to offset your gain. However, you are entitled to deduct up to $3,000 of what is leftover in capital losses from your income using Schedule D. For married people filing separately, this amount is limited to $1,500 each. For this example, that leaves $7,000 that can be carried forward to the next year when the process starts all over again.
Keep in mind that you cannot just choose whatever losses you would like to offset whatever gains you may like. There are specific rules to be followed here. The first step is to offset all your short-term gains with your short-term losses. Next you offset all of your long-term gains with your long-term losses. Then you must offset these two results. What you need to be careful of is being forced to offset long-term gains with short-term losses when you have large short-term losses and small short-term gains. You do not have to do this and may choose to wait for a future tax year when you may have a large amount of short-term gains that could use the carried-over short-term losses to offset them. Generally, you will want to try to keep your long-term gains intact because of their preferred tax rate.
The rules that apply to offsetting and carrying-over capital losses can seem rather confusing. For additional information on capital losses and carryovers, see IRS Publication 544, Sales and Other Dispositions of Assets, Publication 550, Investment Income and Expenses and Publication 551, Basis of Assets.