Taxes vary by type of account. For flexible accounts, you may be subject to capital gains taxes. A capital gain occurs when you sell something for more than you spent to acquire it. This happens a lot with investments - and the length of ownership matters. If you sell an asset after owning it for more than a year, any gain you have is "long-term" capital gain. If you sell an asset you've owned for a year or less, it's a "short-term" capital gain. The tax rate applied to short-term gains is significantly larger than that from long-term gains. Here is Investopedia’s definition for capital gain (and loss) -- we really like their definition as it’s straight-forward and relatively jargon-free.
For IRA holders, it depends on the type of account you have -- i.e., Roth vs traditional. With a Traditional IRA, you can deposit pre-tax dollars and pay the tax upon withdrawal. With a Roth IRA, post-tax dollars are deposited into the account and the funds are not taxed during a withdrawal.