Yes. Put as much money as you can into tax-sheltered retirement accounts, such as 401(k)s and IRAs. That's because the investments in those accounts grow tax-free until retirement - meaning you'll wind up with way more money in your old age than you would have otherwise.
When you own stocks outside of tax-sheltered retirement accounts such as IRAs or 401(k)s, there are two ways you might get hit with a tax bill. If your stock pays a dividend, those dividends are taxed at a rate of up to 15% at the end of each year for most tax-payers and at 20% for individuals with more than $415,050 in taxable income ($466,950 for married couples).
In addition, if you sell a stock, you pay 15% (20% for high earners) of any profits you made over the time you held the stock. Those profits are known as capital gains, and the tax is called the capital gains tax. One exception: If you hold a stock for less than a year before you sell it, you'll have to pay your regular income tax rate on the gain - a rate that's usually higher than the capital gains tax.
For more details, see Investments and taxes.