Calculating capital gains tax on the sale of California investment property involves several steps:

Determine your “adjusted basis” in the property. This is the original purchase price, plus any improvements you made to the property, and any other adjustments allowed by the tax code.

Determine the “sale price” of the property. This is the amount you received for the property after closing costs, real estate commissions, and other expenses related to the sale have been subtracted.

Calculate the “realized gain” on the sale. This is the difference between the sale price and the adjusted basis.

Determine applicable depreciation recapture. Depreciation recapture is typically 25% of the depreciation taken over the lifetime of owning the asset.

Calculate the capital gains tax owed. The capital gains tax rate in California is generally the same as the federal rate, which varies depending on your income and the amount of the gain. If you have held the property for more than one year, the federal long-term capital gains tax rate is currently 20%. California also has a state capital gains tax, which is currently 13.3% for high- income earners.

Factor in the Net Investment Income Tax (NIIT) if applicable. If your adjusted gross income exceeds certain thresholds, you may also owe the NIIT, which is an additional 3.8% tax on the lesser of your net investment income or the amount by which your adjusted gross income exceeds the threshold.

File the appropriate tax forms and pay any tax owed. You will need to report the capital gains on your federal tax return using Form 8949 and Schedule D, and you may also need to file a California state tax return.

It is important to note that calculating capital gains tax can be complex, and there may be additional factors to consider based on your individual circumstances.

It's important to note that a 1031 exchange can be complex, and it's important to consult with a tax professional and qualified intermediary to ensure that the exchange is conducted properly and in compliance with IRS guidelines.