Okay, so you understand the basic principle that sales price - cost of selling - adjusted tax basis = taxable gain (or loss). But what happens if you sell more than one capital asset during the year? What if you take a loss on one sale, but a gain on another? How do you determine the amount of your gains, and will they be short-term, or long-term gains eligible for the special tax rates?
The general principle is that you must net your short-term gains against your short-term losses, to get a total short-term gain or loss. Then, you net your long-term gains against your long-term losses, to get a total long-term gain or loss. Finally, you net your total short-term gain or loss against your total long-term gain or loss.
If the ultimate result is a long-term gain, it will be subject to the maximum capital gains tax rate of 20 percent. If the result is a short-term gain, it will be subject to tax at your regular income tax rate.
If the result is a loss, whether short-term or long-term, up to $3,000 of it (or up to $1,500 for married people filing separately) will be deductible from your ordinary net income. If your losses exceed this amount, you can carry them over and deduct them in subsequent years until they are used up.
Allocating gains of part-business property. For depreciable property that is used for both business and personal purposes, both the basis and sale proceeds of the property must be allocated between the two types of usage.
Essentially, the property will be treated as if it were two separate pieces of property. This applies to both real estate (e.g., your home office), and to property like cars, computers, office furniture, and equipment.
As a general rule, the taxable gain or loss on the business portion's disposition will be reported on Form 4797, Sale of Business Property.
In contrast, any gain or loss on the personal portion will be reported on Schedule D of your individual income tax return. Note that any losses on the personal portion of the home or equipment are not deductible, although gains on this portion may be taxable.
In the case of a home office, a special provision in the law says that up to $250,000 in capital gains (or $500,000 on a joint return) will be excluded upon sale of the home, if the home has been used as a principal place of residence for two out of the last five years before the sale. If you have been using part of your house as a home office for more than three years out of the last five years, you cannot meet the "two out of five years" residence rules for that portion of the home, since you have been using the office as a place of business, not your residence. Therefore, you would need to treat the property as two separate assets, and only the gain on the home would be excludable.
If you have used your home office for no more than three years out of the last five, you do not need to treat the home office as a separate business asset. However, you would still need to recapture any depreciation claimed on the home for periods after May 6, 1997. Except for the recaptured depreciation, the gain on the entire home would be excludible.