Deductions & credits

You don't provide enough details. First rule is that the two transactions are taxed completely separately. They have nothing to do with each other. The flip is fairly simple. You have a short term capital gain, this is treated like an investment that you bought a sold, and because you held it less than 1 year, it is a short term capital gain which is taxed the same as ordinary income. Your cost basis is what you paid for the home plus what you paid for permanent improvements. You can't take an adjustment for repairs. Permanent improvements make the property more valuable or extend its useful life, and are more extensive than repairs, which simply maintain the property in as-is condition. Painting is usually a repair, while a new roof or floor would be an improvements. (But, if you renovate the kitchen, which is an improvement, the cost of painting as part of the renovation counts as part of the improvement.) You include the costs you actually paid for contractors and materials for the improvement, don't include any adjustment for the value of your time. You can also take a cost basis adjustment for certain closing costs as described in publication 523. Your capital gain is the difference between the selling price and your adjusted basis, and you will be taxed on it at ordinary income tax rates. The home is more complicated, although all the rules are covered in publication 523. Your capital gain is figured the same way—selling price minus adjusted basis, and you can take the same basis adjustments for permanent improvements and certain closing costs. (However, your improvement must still be part of the property. If you replaced the furnace in 2000 and again in 2020, only the cost of the furnace in 2020 counts as an adjustment to cost basis.). Then, if the home was ever a rental or for business (home office, home day care, etc.), your adjusted basis is reduced by depreciation you took or could have taken. Then, if you lived in the home as your main home for at least 2 of the 5 years prior to the sale, you can exclude the first $250,000 of capital gains from tax, or $500,000 if you are married filing jointly. Any capital gain more than your exclusion is taxed as a long term capital gain, which has reduced rates compared to short term gains. If the home was used for business or rental, the depreciation you took has to be "recaptured"--that means paying tax on the portion of the gain due to depreciation at recapture rates, which are regular tax rates but capped at 25%. https://www.irs.gov/pub/irs-pdf/p523.pdf