Anonymous
Not applicable

Can you offset home sale capital gains with short term capital losses from stocks?

I have sold my primary residence and an investment property and after the adjusted basis and deductions I will owe capital gains taxes on the properties.  My understanding is you can offset the capital gains with losses whether it is short or long term from any other investments.    For example, if I needed to pay 50k in capital gains then could you invest in some risky stocks and if up, keep the stocks, but if down, just sell when you hit close to 50k to offset the real estate gains?  I know there is a 30 day rule for reinvesting in stocks but was curious about the capital gains side and if so are there any downsides to doing that?