The short answer
Two things shrink a taxable gain: selling expenses, which reduce the amount realized, and capital improvements, which increase your adjusted basis. Repairs you already deducted and anything you cannot document do neither, and depreciation you claimed, or could have claimed, cuts basis back down. Once those adjustments are made, whatever gain remains is what a 1031 exchange would defer.
At a glance
| Formula | Sale price minus selling expenses equals amount realized; amount realized minus adjusted basis equals gain |
|---|---|
| Selling expenses | Commissions, advertising, legal fees and other costs directly tied to the sale |
| Basis increases | Improvements with a useful life of more than one year, local assessments, zoning costs, title defense |
| Not added to basis | Repairs and maintenance you deducted, and your own labor |
| Basis decreases | Depreciation allowed or allowable, casualty reimbursements, easement payments |
| Improvement test | A betterment, a restoration or an adaptation to a new use is capitalized |
| Records | Keep property records until the limitations period ends for the year you dispose of the property |
| After an exchange | Keep records for both the old and the new property until the new one is sold |
The gain is the amount realized minus adjusted basis, and each side has its own list of adjustments
Section 1001 defines gain as the excess of the amount realized over adjusted basis. Publication 544 says the amount realized is all the money you receive plus the fair market value of any property or services, plus any of your liabilities the buyer assumes, such as a mortgage or unpaid real estate taxes. Its worked example then subtracts selling expenses before comparing the result to basis.
Adjusted basis starts with cost, which under Publication 551 includes settlement costs you paid to buy the property: legal fees, recording fees, surveys, transfer taxes and owner's title insurance. It does not include loan charges such as points, mortgage insurance or a lender's appraisal fee. Section 1016 then adjusts that cost up and down over the years you own it.
So there are only two levers. You can show more selling expenses, which lowers the amount realized, or you can show a higher adjusted basis. Everything on this page is one of those two.
Selling expenses come straight off the price, but prorations and loan items on the statement do not
Publication 523 lists selling expenses as costs directly associated with the sale: sales commissions, advertising fees, legal fees, loan charges you paid that would normally be the buyer's, and other fees or costs to sell. The same logic applies to a rental, where the expenses reduce the amount realized reported on Form 4797.
Not every line on the closing statement qualifies. Rent and property tax prorations, security deposits handed to the buyer and payoffs of your own mortgage settle accounts between the parties; they are not costs of selling. Publication 551 draws the same line for exchanges, separating exchange expenses such as commissions and attorney fees from property taxes, rent prorations, security deposits and repairs. Closing costs paid from exchange funds walks through the statement line by line for an exchange.
Capital improvements raise basis only if they are improvements, and only if you can prove them
Publication 551 increases basis by improvements with a useful life of more than one year, assessments for local improvements such as roads and sidewalks, zoning costs, the cost of extending utility lines, and legal fees to defend or perfect title. Its table gives examples: an addition, an entire new roof, paving, central air conditioning and rewiring.
Publication 527 states the test landlords apply. An expense is an improvement if it results in a betterment, a restoration or an adaptation to a new or different use; otherwise it is a repair you deduct in the year paid. The detailed rules sit in Reg. section 1.263(a)-3, including a small-taxpayer safe harbor for a building with unadjusted basis of $1,000,000 or less, which lets you deduct annual work up to the lesser of 2 percent of that basis or $10,000 when average gross receipts are $10,000,000 or less.
The trade-off matters at sale. A cost you deducted as a repair, or under the safe harbor or the $2,500 per-invoice de minimis election described in the IRS tangible property guidance, already saved tax and never enters basis. Your own labor never counts, and Publication 527 tells you to keep improvement records because you will need them when you sell.
Depreciation pulls basis back down, whether or not you claimed it
Publication 551 decreases basis by depreciation you deducted or could have deducted, by casualty reimbursements, by section 179 deductions and by easement payments. Each improvement you capitalize is depreciated as its own asset, so a 2019 roof has been shrinking your basis since it was placed in service.
The allowed-or-allowable rule is the one that surprises owners. If you skipped depreciation, basis still falls by the full amount you could have taken, and the gain is the same as if you had claimed it; recapture on depreciation you never claimed and catching up missed depreciation before a sale cover the fix. The depreciation share of the gain is taxed first, at up to 25 percent for buildings, as capital gains tax on a rental explains.
Worked example: a rental bought for $300,000 and sold for $650,000
Hypothetical, round figures. An owner bought a rental in 2014 for $294,000 plus $6,000 of title, recording and legal costs, for a cost basis of $300,000. Later work included a $18,000 roof replacement and a $25,000 kitchen remodel, both capitalized, plus $9,000 of painting and plumbing repairs deducted on Schedule E. Depreciation allowed on the building and the two improvements totals $95,000.
Adjusted basis is $300,000 plus $43,000 minus $95,000, or $248,000. The owner sells in 2026 for $650,000 and pays $39,000 in commissions, legal fees and seller-paid transfer tax, so the amount realized is $611,000 and the gain is $363,000. The $9,000 of repairs and the property tax proration on the statement change nothing.
Without invoices for the roof and kitchen, the owner would have to defend that $43,000 under examination, and every dollar not allowed comes back as gain, net of the depreciation already taken on it. Run your own numbers with your CPA.
Keep the records for as long as the property, and for longer if you exchange
The IRS page on how long to keep records says to keep records relating to property until the period of limitations expires for the year you dispose of it. Because a replacement property received in a nontaxable exchange takes the basis of the property you gave up, you must keep the records on the old property as well as the new one until the limitations period expires for the year you dispose of the new one. Records to keep after a 1031 lists them.
In an exchange the same adjustments still matter. Selling expenses on the relinquished property reduce the gain that is deferred, exchange expenses on the replacement side are added to its basis, and the carryover basis described in basis in replacement property is built from the same numbers. Owners who sell into a traditional DST carry the same basis records forward into the fractional interest.
Related questions
Are real estate commissions deducted on Schedule E or subtracted from the sale?
They are subtracted from the sale price to reach the amount realized; they are not a rental expense. Publication 523 lists commissions first among selling expenses.
Does a new roof increase basis or count as a repair?
Replacing an entire roof is listed in Publication 551 as a capital improvement that increases basis. Patching a leak to keep the roof in its ordinary condition is generally a repair.
Can I add the value of my own labor to basis?
No. Publication 527 includes material and labor costs you pay for an addition or improvement but excludes your own labor.
Do loan fees from when I bought the property increase basis?
No. Publication 551 excludes points, mortgage insurance premiums, loan assumption fees, credit reports and lender-required appraisals from basis; for business property some are deducted and others amortized over the loan.
What if I have no records for improvements made decades ago?
Basis can be reconstructed from closing statements, permits, insurance records and lender files, but the burden of proof is yours. The live page on calculating adjusted basis on a rental shows the starting point.
Sources
Checked against these publications on September 30, 2026. Rules and figures change; confirm the current version with your CPA or attorney before you act. This page is general information, not tax or legal advice.
- IRC section 1001, determination of gain or loss
- IRC section 1016, adjustments to basis
- IRS Publication 551, Basis of Assets
- IRS Publication 544, Sales and Other Dispositions of Assets
- IRS Publication 523, Selling Your Home
- IRS Publication 527, Residential Rental Property
- Treas. Reg. section 1.263(a)-3, amounts paid to improve tangible property
- IRS, Tangible property final regulations FAQ
- IRS, How long should I keep records
