Q. About 18 years ago, my husband and I bought our first house. We lived there about nine years and then, because my husband changed his job, we moved to a house closer to where he works. We have rented the first house out for the past nine years, and now we are considering putting it on the market for sale. We suddenly will have a large amount of capital gain. I wonder if we can put part of this gain into our Keogh plan so that we can save on our income taxes. Are there any other ways of avoiding this capital gains tax?

A. Let us assume that you purchased the property for $50,000 and it is now worth $200,000. The gross profit is $150,000.

If this were your principal residence -- in other words, the home where you live -- a different set of tax rules would apply to assist you in deferring the profit when you sell. However, because the home that you own is rental property -- used for business purposes -- another set of tax rules should be explored.

For gains on business property, the tax law currently breaks the type of gain and, hence, the amount of tax that has to be paid, into two categories: "ordinary income" and "capital gains."

Oversimplified, if you make a short-term profit, any gain that you make is taxed as ordinary income. Currently, if you are in the top bracket -- 50 percent -- then half of the gain (profit) must be paid to the government. On the other hand, if your profit is based on property you have held for a longer period of time, then you are treated as having a capital gain, and the tax is calculated on a different basis.

To determine the holding period, you have to determine when you purchased the property. If you acquired the real estate before June 23, 1984, you have to hold on to the property for more than one year to treat the property as a capital gain. If you purchased the property after June 22, 1984, then you only have to hold the property for more than six months to qualify for the capital-gains treatment.

It should be noted that Congress is considering yet another revision to the capital gains tax and, thus, planning for real estate investors has a lot of uncertainties.

For most real estate investors, the distinction between six months and one year is really academic, because most real estate investors hold their property for more than one year.

If you qualify for capital-gains treatment, then you are entitled to deduct 60 percent of the amount of any profit, and the remaining 40 percent of the net gain is subject to tax at the ordinary income tax rate. What this means is that, even if you are in the highest tax bracket, you have to pay taxes equal to only 20 percent of the overall gain.

There has been a lot of confusion in this area, because many taxpayers believe that they have to pay the full 40 percent of their profit. Boiling the complicated tax formula down to simple English: If you're entitled to capital-gains-tax treatment, then the most you will have to pay for the gain you made is 20 percent of your profit.

But profit (or gain) is also a tricky concept. In our example, you purchased the property for $50,000 and are now prepared to sell it for $200,000. Your gross profit is $150,000. However, many items can be included to legitimately offset the total profit and to obtain a net profit for tax purposes.

For example, if you made improvements to the property and did not deduct those improvements over the years, they can be included for tax purposes to offset your profit. If you sell your property through a real estate company, the commission is also deducted from your profit, and the expense of fixing up a residence for sale can also be deducted from the amount realized so as to reduce the taxable income, if certain conditions have been met:The expenses must not be otherwise deductible in computing taxable income. The expenses must be paid within 30 days after the residence is sold. The work must have been done during the 90 days ending on the day the contract to sell the old residence was made.

Now that we have analyzed the amount of tax you will have to pay, the question is whether there are any other creative methods to further reduce or defer the tax. Unfortunately, the law treats that sale -- and the profits you have made -- as a separate taxable event. If, however, you buy other real estate or find other shelters for your sales proceeds, then those shelters or deductions can be included as an offset against your profit when you report it next year.

Keep in mind that, if you sell your property in 1986, the profit should be included in the tax return you file in 1987. All income and legitimate expenses for 1986 should be considered when determining the amount of tax you will owe on your 1986 returns. Thus, if you have sheltered money by putting it in a Keogh plan, an IRA program or another "tax shelter," and if you are entitled to any deductions for the 1986 tax year, those deductions can be used as an offset against your capital gains.

You also should ask yourself one additional question before you put your house on the market: Insofar as your property has appreciated considerably, would you be better off refinancing that investment property and continuing to rent it rather than selling it?