Selling a rental is the one tax event where the form does more than tally a number. The sale of a building you have been depreciating gets split across two parts of Form 4797, the land and the building travel different routes, and a slice of your gain gets taxed at a higher rate than the rest. Most of the DIY threads you find online get the land-versus-building split wrong, which throws off both the recapture and the rate. The goal here is not to file this yourself. It is to understand what your CPA or your tax software is doing, so you can check it.
The structure is less intimidating once you see why it exists. A rental held more than a year is Section 1231 property, a hybrid that gets capital-gain treatment on the upside and ordinary-loss treatment on the downside. The depreciable building inside it is Section 1250 property, which carries its own recapture rule. Form 4797 is built to keep those two ideas straight. Here is the walk, in the order the form forces the numbers to move.
First, split the sale into land and building
Before any line gets filled in, you have to break the property into its two pieces, because they are taxed differently. Land does not depreciate, so it has no recapture. The building does depreciate, so it carries Section 1250 recapture. You already made this split once, on the day you placed the property in service and started your depreciation schedule, and you use the same ratio now.
Say you bought a single-family rental for $300,000 and your county assessment put 20 percent of the value on land. That is $60,000 of land and $240,000 of building. When you sell for $400,000, you allocate the sale price by the same logic: roughly $80,000 to the land and $320,000 to the building, adjusted if the land and building have appreciated at different rates. Selling costs get split the same way. Get this ratio right and the rest of the form follows. Get it wrong and every number downstream is off. If you want a refresher on how the original split drives your deduction, see the 27.5-year depreciation math.
Part III: the building, line by line
The building is Section 1250 property, so it goes in Part III of Form 4797, the part that exists to compute depreciation recapture. You enter a separate column for each asset sold. For a typical rental that is one column for the building. The lines that matter:
- Line 20, gross sales price. The portion of the sale price allocated to the building, using the ratio above. In the example, $320,000.
- Line 21, cost or other basis plus improvements. The original building basis plus any capitalized improvements you added over the years. Say it is $240,000 plus a $20,000 roof you capitalized, so $260,000.
- Line 22, depreciation allowed or allowable. The total depreciation you took, or were entitled to take, over the holding period. This is the line people underreport. The IRS reduces your basis by depreciation allowable whether or not you actually claimed it. Say you held the building eight years and took $69,000.
- Line 23, adjusted basis. Line 21 minus line 22: $260,000 minus $69,000 is $191,000.
- Line 24, total gain. Line 20 minus line 23: $320,000 minus $191,000 is $129,000.
Lines 25 through 30 then separate that $129,000 gain into its taxable flavors. For residential rental real estate depreciated straight-line, there is usually no ordinary recapture under Section 1250 itself, so line 26 comes out near zero. The whole gain is Section 1231 gain, but the part equal to your depreciation, the $69,000, is tagged as unrecaptured Section 1250 gain and tracked separately. That is the piece that gets the higher rate.
Part I: the land
The land allocation, around $80,000 of sale price against your $60,000 land basis, is a clean Section 1231 transaction with no recapture. It goes straight into Part I of Form 4797, line 2, with the description, the dates acquired and sold, the sale price, the basis, and the $20,000 gain. Part I is where pure Section 1231 gains and losses get netted. Nothing complicated happens here, which is exactly why land lives here and the building does not.
How the gain flows out to Schedule D
This is the part the form summaries online skip. Form 4797 is not the end of the trip. The Section 1231 gain that survives Part I and Part III gets carried to Schedule D as a long-term capital gain, where it sits with the rest of your capital transactions and feeds the capital-gains rate calculation. The $69,000 of unrecaptured Section 1250 gain rides along but is flagged so the tax worksheet can apply a maximum 25 percent rate to it instead of the lower long-term rate the rest of the gain gets. So a single sale produces three taxable layers: the land gain at the long-term rate, the building's appreciation above its original cost at the long-term rate, and the depreciation portion at up to 25 percent.
Form 8949 enters the picture only for installment pieces or specific adjustments. A straightforward all-cash rental sale usually moves 4797 to Schedule D directly. If a buyer is paying you over time, that is a separate Form 6252 conversation worth raising with your preparer. For the tax concept underneath all of this, rather than the reporting mechanics, read depreciation recapture when you sell.
The mistakes that trigger a letter
A handful of errors account for most of the corrected returns I have seen on rental sales. They are all avoidable if you check the inputs before the form is filled.
- Putting the building in Part I. Drop the building into Part I and the unrecaptured Section 1250 gain never gets calculated, which understates the 25 percent layer. The building belongs in Part III.
- Forgetting depreciation you never claimed. Line 22 is allowed or allowable. If you self-managed without a depreciation schedule, you may owe recapture on deductions you never took. Catch this before closing, not after.
- Skipping the land split. Reporting the whole property as one Section 1250 asset overstates recapture on the land portion, which has none.
- Misallocating selling costs. Commissions and closing costs reduce gain, but they have to be split between land and building on the same ratio, or one part of the form is overstated.
The whole exercise is really about whether you can hand your preparer four numbers without flinching: placed-in-service date, original cost basis with its land split, accumulated depreciation, and the closing statement. If those live in a clean place, Form 4797 is mechanical. If they live in a folder of PDFs and a spreadsheet that lost a tab two years ago, the sale is where it catches up with you. I built rents.ai partly for that moment: it keeps per-property cost basis, placed-in-service date, accumulated depreciation, and the closing statement in one place, exportable for your CPA. It will not file Form 4797 for you, and it is not tax advice. It only makes sure the inputs exist when the high-stakes year arrives. The same discipline that powers a tidy Schedule E each year is what makes the sale year painless.
This walkthrough is meant to help you understand and check what your CPA or tax software is doing, not to file your own return. The numbers are a hypothetical example to show how the form moves, not advice for your situation. Read the official Form 4797 and its instructions and IRS Publication 544, and bring the actual figures to a preparer before you file.