Where you live can have a big impact on how much you pay in capital gains taxes. In addition to the federal capital gains tax and, for the highest earners, a net investment income tax, 41 states and the District of Columbia have their own capital gains taxes. How high is the tax in your state? Read on to find out.

Federal capital gains tax rate
Short-term capital gains, which are profits on the sales of assets held less than a year, are taxed as regular income. Assets held longer than a year are taxed at the long-term capital gains tax rate, which is set lower than the income tax rate to encourage investment and is based on the tax bracket you fall into.

Tax Bracket

Long-Term Capital Gains Rate

10%-15%

0%

25%-35%

15%

39.6%

20%

Source: IRS.

Then there's the net investment income tax. Single taxpayers who make more than $200,000 a year, or $250,000 if they are married and filing jointly, pay an additional 3.8% on investment income based on a simple formula. If this applies to you, you can find out more on the net investment income tax in this article.

States with the highest capital gains tax rate
On average, states add 5 percentage points to the capital gains tax rate. This chart shows the top marginal capital gains tax rate in each state:

Your state capital gains tax rate will depend not only on your tax bracket but also whether your state allows deductions for federal capital gains taxes or has other special rules. However, some states keep it extremely simple.

Nine states have no capital gains tax rate:

  1. Alaska
  2. Florida
  3. Nevada
  4. New Hampshire
  5. South Dakota
  6. Tennessee
  7. Texas
  8. Washington
  9. Wyoming

At the other end of the spectrum, California has the highest capital gains tax rate at a whopping 13.3%. That means there is more than a 50% difference between taking a large capital gain in California and in any of the nine states with no capital gains tax. You can perhaps understand why Facebook (META 1.54%) investor Eduardo Saverin infamously decided to leave California, and the U.S., instead of paying massive capital gains taxes on the Facebook IPO in 2012.

Because it is the technology capital of the world and has the highest capital gains tax rate of any state, California can experience a windfall when technology companies go public. Revenue from the capital gains tax for the 2012-2013 budget year -- the year Facebook went public -- contributed 10.5% of the state's general tax revenue. Now, the state could reap big tax rewards if Yahoo! (NASDAQ: YHOO) decides to sell its stake in Alibaba (BABA 0.09%), which has been a big topic of conversation among Yahoo! investors after Barron's and then Starboard Capital raised the issue.

There is a tie for the second-highest capital gains tax rate between Minnesota and Oregon, at 9.9% each. Rounding out the top five are Iowa, New Jersey, and Vermont, all with a 9% rate. D.C. also charges 9%.

The only surefire way to avoid capital gains taxes is not to sell your investments. If you do foresee yourself having capital gains, however, a little planning can go a long way. If you have a lot of time, the government offers various tax-advantaged accounts, such as individual retirement accounts and 401(k)s. Other methods can help cut your bill, too, such as donating to charity or contributing to trusts.