Filed
/
Library
/
Individuals

Section 1231 gain: Form 4797 parts and the five-year lookback

A section 1231 gain is a gain on the sale of depreciable or real property used in a trade or business and held for more than 1 year, or on certain involuntary conversions. A net section 1231 gain for the year is long-term capital gain and a net loss is ordinary. Under IRC section 1231(c), a net gain is ordinary income up to the net section 1231 losses of the 5 preceding years.

On this page
“Your net section 1231 gain on line 7 is treated as ordinary income to the extent of your nonrecaptured section 1231 losses.” IRS, Instructions for Form 4797 (2025)

What is a section 1231 gain?

A section 1231 gain is a recognized gain on the sale or exchange of property used in a trade or business, or on certain involuntary conversions, under IRC section 1231(a)(3). IRC section 1231(b) defines that property as depreciable property and real property used in a trade or business and held for more than 1 year, other than inventory and property held primarily for sale to customers. All section 1231 gains and losses for the year are netted. If gains exceed losses, IRC section 1231(a)(1) treats them as long-term capital gains and losses. If they don't, the gains and losses are not capital, so a net loss is an ordinary loss.

Publication 544 (2025) adds two points. Property held for the production of rents or royalties is generally considered used in a trade or business. And gain that is ordinary income under the depreciation recapture rules is taken out first: only gain above the recapture amount is section 1231 gain. The netting is done on Form 4797, Part I.

Which property goes in which part of Form 4797?

Form 4797 sorts a section 1231 gain or loss by holding period and by whether the sale produced a gain or a loss, according to the chart "Where To Make First Entry for Certain Items Reported on This Form" in the 2025 Instructions for Form 4797. Property held 1 year or less goes in Part II and is ordinary. Depreciable property held more than 1 year and sold at a gain starts in Part III, where recapture is figured, and the gain left over moves from line 32 to Part I, line 6. Depreciable property held more than 1 year and sold at a loss goes straight to Part I, line 2.

Type of propertyHeld 1 year or lessHeld more than 1 year
Depreciable tangible trade or business property, sold at a gainPart IIPart III (section 1245)
Depreciable tangible trade or business property, sold at a lossPart IIPart I
Depreciable real trade or business property, sold at a gainPart IIPart III (section 1250)
Depreciable real trade or business property, sold at a lossPart IIPart I
Farmland held less than 10 years on which soil or water expenses were deducted, sold at a gainPart IIPart III (section 1252)
Farmland held less than 10 years on which soil or water expenses were deducted, sold at a lossPart IIPart I
Real or tangible trade or business property deducted under the de minimis safe harborPart IIPart II
All other farmland used in a trade or businessPart IIPart I
Cost-sharing payment property described in section 126Part IIPart III (section 1255)
Cattle and horses used for draft, breeding, dairy or sporting purposes, sold at a gainPart II (held less than 24 months)Part III (section 1245) (held 24 months or more)
Cattle and horses used for draft, breeding, dairy or sporting purposes, sold at a lossPart II (held less than 24 months)Part I (held 24 months or more)
Raised cattle and horses sold at a gainPart II (held less than 24 months)Part I (held 24 months or more)
Other livestock used for draft, breeding, dairy or sporting purposes, sold at a gainPart II (held less than 12 months)Part III (section 1245) (held 12 months or more)
Other livestock used for draft, breeding, dairy or sporting purposes, sold at a lossPart II (held less than 12 months)Part I (held 12 months or more)
Raised livestock other than cattle and horses, sold at a gainPart II (held less than 12 months)Part I (held 12 months or more)

A building and its land sold together are two entries. The 2025 Instructions for Form 4797 say to allocate the amount realized by fair market value and, for property held more than 1 year, to report the building in Part III and the land in Part I. A partner or S corporation shareholder enters the amount from Schedule K-1 (Form 1065), box 10, or Schedule K-1 (Form 1120-S), box 9, in Part I. The K-1 instructions put a gain in column (g) of line 2.

How does the five-year lookback on a section 1231 gain work?

The five-year lookback treats a net section 1231 gain as ordinary income to the extent of nonrecaptured net section 1231 losses, under IRC section 1231(c)(1). Section 1231(c)(2) defines those losses as the total net section 1231 losses for the 5 most recent preceding tax years, less the part already recaptured against gains in those years. On Form 4797 the gain is on line 7 and the nonrecaptured losses are on line 8. Line 9 is the difference, not below zero.

The 2025 Instructions for Form 4797 give two outcomes. If line 9 is zero, the whole line 7 gain is ordinary and goes on line 12. If line 9 is more than zero, the line 8 amount goes on line 12 and the line 9 amount is a long-term capital gain on Schedule D. Publication 544 (2025) says the losses are applied beginning with the earliest loss in the 5-year period. A loss older than 5 years drops out even if it was never recaptured.

Common miss: line 8 isn't on last year's return
Form 4797 has no carryforward line for nonrecaptured section 1231 losses. Line 8 has to be rebuilt from the Forms 4797 for the 5 preceding years: each year's net loss on line 7, less any amount already treated as ordinary income on line 12 in a later year.

What other rules change a section 1231 gain?

Three other rules change a section 1231 gain before or after the netting. Depreciation recapture comes first: on Form 4797, Part III, the section 1245 and section 1250 amounts on line 31 are ordinary income on line 13, and only the line 32 remainder reaches Part I. Casualties and thefts are tested separately. Under IRC section 1231(a)(4)(C), if recognized losses from casualty or theft of business property and of capital assets held more than 1 year in connection with a trade or business or a transaction entered into for profit exceed the recognized gains, those gains and losses stay out of the section 1231 netting.

The third rule applies after the netting. A net section 1231 gain that becomes long-term capital gain can still include unrecaptured section 1250 gain, which is taxed at up to 25%. The Unrecaptured Section 1250 Gain Worksheet subtracts the Form 4797, line 8, amount on its own line 8, so the lookback reduces that gain first.

What does a five-year lookback calculation look like?

For example, a sole proprietor has a 2025 net section 1231 gain of $48,000 on Form 4797, line 7, after recapture. The prior Forms 4797 show net section 1231 losses of $9,000 in 2019, $4,000 in 2020 and $22,000 in 2022, all deducted as ordinary losses, and a net section 1231 gain of $6,000 in 2023. There were no section 1231 transactions in 2021 or 2024. In 2023 the lookback years were 2018 through 2022, so the $6,000 gain was ordinary income and was applied to the 2019 loss, the earliest in that period.

StepRule or Form 4797 lineAmount
Net section 1231 losses deducted in 2019, 2020 and 2022Ordinary losses in those years: $9,000, $4,000 and $22,000$35,000
2023 net section 1231 gain, all ordinary income in 20232023 Form 4797, lines 7 and 12$6,000
2019 loss left after the 2023 recapture, earliest loss firstPub. 544, nonrecaptured section 1231 losses$3,000
2019 loss still in the 2025 lookback (2020 through 2024)IRC section 1231(c)(2): 5 most recent preceding years$0
2020 loss not yet recapturedLookback year 1 of 5$4,000
2022 loss not yet recapturedLookback year 3 of 5$22,000
2025 net section 1231 gainForm 4797, line 7$48,000
Nonrecaptured net section 1231 losses from prior yearsForm 4797, line 8$26,000
Ordinary incomeForm 4797, line 12, into line 17$26,000
Long-term capital gainForm 4797, line 9, to Schedule D, line 11$22,000

The $26,000 goes on Form 4797, line 12, and with the other Part II amounts reaches Schedule 1 (Form 1040), Part I, line 4, through line 18b. The $22,000 goes on Schedule D, line 11, as long-term capital gain. The $3,000 left from 2019 is never recaptured, because 2019 is outside the 5 preceding years for 2025. After 2025 no nonrecaptured losses remain, so a 2026 net section 1231 gain would be long-term capital gain in full.

What do reviewers check on a section 1231 gain?

A reviewer checking a section 1231 gain asks for the Forms 4797 from the 5 preceding years before looking at the current one. Line 8 can't be tested without them. A first-year client needs the prior preparer's returns for the same reason. A year with a net gain matters as much as a year with a net loss, because a gain year may already have used up part of an older loss.

The reviewer then checks that each sale started in the right part of the form, that recapture was taken out in Part III, and that the split between line 9 and line 12 follows from lines 7 and 8. Pass-through amounts from a Schedule K-1 (Form 1065) are netted with the taxpayer's own sales on line 7.

Holding period supports Part I
Property held 1 year or less belongs in Part II, and cattle and horses need 24 months.
Instructions for Form 4797 (2025), Where To Make First Entry chart
Recapture came out first
Gain on depreciable property held more than 1 year runs through Part III before line 6.
Form 4797 (2025), lines 31 and 32; Pub. 544 (2025)
Line 8 covers 5 preceding years
Net section 1231 losses from each of the 5 preceding years are counted, less amounts already recaptured.
IRC section 1231(c)(2); Instructions for Form 4797 (2025), line 8
Earliest loss is used first
Recapture is applied to the oldest loss in the 5-year period, which decides what drops out next year.
Pub. 544 (2025), Nonrecaptured section 1231 losses
Line 9 and line 12 tie to Schedule D
Line 9 goes to Schedule D, line 11, and the recaptured amount goes on line 12 as ordinary income.
Form 4797 (2025), lines 9 and 12
K-1 amounts are in Part I
A gain or nonpassive loss from box 10 of Schedule K-1 (Form 1065) or box 9 of Schedule K-1 (Form 1120-S) is entered in column (g) of line 2.
Partner's Instructions for Schedule K-1 (Form 1065) (2025), box 10; Instructions for Form 4797 (2025), line 7

Which guides go with section 1231 gain?

Preparers working on section 1231 gain usually need these library guides next. Each one covers the related form or rule line by line, with a worked example and review checks.

Every line checked against the documents the client sent

Filed reads the client's closing statements, depreciation schedules, Schedules K-1 and the Forms 4797 from the 5 preceding years, then checks every section 1231 entry on Form 4797 against them. Anything that doesn't tie comes back as a review item with a citation to the source.

Book a demo
Example review item
Form 4797 line 8 is blank with prior-year losses

Line 7 shows a $48,000 net section 1231 gain and line 8 is blank, so the full amount went to Schedule D. The 2020 and 2022 Forms 4797 show net section 1231 losses of $4,000 and $22,000 that have not been recaptured, which makes $26,000 ordinary income on line 12. Confirm no other gain year recaptured them.

Source: 2020 and 2022 Forms 4797, line 7; 2023 Form 4797, line 12

Common questions

Is a section 1231 loss ordinary or capital?

A net section 1231 loss is an ordinary loss. IRC section 1231(a)(2) provides that when section 1231 gains do not exceed section 1231 losses for the year, the gains and losses are not treated as gains and losses from sales of capital assets. Publication 544 (2025) states the result directly: a net section 1231 loss is ordinary loss.

Where does a K-1 section 1231 gain go on the return?

A K-1 section 1231 gain goes on Form 4797, Part I, line 2, column (g). The 2025 partner instructions for Schedule K-1 (Form 1065), box 10, say to enter "From Schedule K-1 (Form 1065)" across columns (b) through (f). It is then netted on line 7 with the taxpayer's other section 1231 gains and losses.

How long do nonrecaptured section 1231 losses last?

Nonrecaptured section 1231 losses last for 5 tax years after the loss year. IRC section 1231(c)(2) counts net section 1231 losses for the 5 most recent preceding tax years, so a 2020 loss affects gains through 2025 and not after. Publication 544 (2025) applies the earliest loss in the period first.

Camron Momeni, CPA
About the author
Camron Momeni, CPA
VP of Tax Experience

Camron Momeni, CPA, has more than 18 years of public accounting and tax startup experience, including 14 years as a CPA serving firms from the Big Four to solo practitioners. He prepared and reviewed returns across partnerships, S corporations, C corporations, exempt organizations, estates and trusts, and as a product manager at Crowe he built K1 Aggregator and C-TRAC, now sold as 990Tracker. At Filed he is VP of Tax Experience, leading customer success, onboarding and solutions engineering.

LinkedIn profile