It depends on your goals.
Paying extra on your mortgage effectively gives you a return equal to your mortgage rate. For example if your mortgage rate is 5%, then every extra dollar you pay means one less dollar you're paying interest on. That compounds for as long as you are paying the mortgage because each month from that point forward a bigger portion of your payment goes toward principle instead of interest.
Since mortgage rates have been below 5% for so long, most investments will outperform that rate. But they come with more risk and higher volatility. The return on investment from extra mortgage payments is virtually guaranteed whereas stocks & bonds could go up or down at any time.
Investments are generally much more liquid, meaning you can withdraw money from stocks & bonds anytime you want. But if you pay extra on your mortgage you can't just withdraw that money, it would require an expensive home equity loan to borrow against that equity. So the mortgage pay-down is not a good choice if you think you'll want or need to use the money in the foreseeable future.
You should also consider the tax consequences of each option.
If your employer offers a 401k match, then ALWAYS invest at least enough to get that matching money. Even 25 cents on the dollar is equivalent to getting an instantaneous 25% return, far better than you'll ever get with any other investment.