Investing in the stock market can help you build long-term wealth, but it can get expensive quickly.

Some stocks cost thousands of dollars per share, and you'll need to invest in at least a dozen or so different stocks to create a diversified portfolio. At that rate, you could easily spend tens of thousands of dollars just to get started investing.

However, there are ways to invest without breaking the bank. With these three options, you can begin investing for $100 or less.

Two people sitting on a couch looking at documents

Image source: Getty Images.

1. Contribute to your 401(k) or IRA

One of the easiest ways to invest in the stock market is to contribute to your employer-sponsored 401(k) or your IRA.

The 401(k) and IRA are some of the most hands-off ways to invest, because you don't need to worry about picking stocks or deciding when to buy or sell. You could also choose to contribute to a target-date fund through your 401(k) or IRA for an even more hands-off experience. With a target-date fund, you simply choose the year you plan to retire, and the fund will adjust your investment allocation accordingly.

Also, when you invest in a 401(k) or IRA, you can contribute as much or as little as you want. If you only have a few dollars to spare each week, that's OK -- you can invest whatever you can afford. You can also set up your account so that you're contributing a specific amount every week or month, or with each paycheck. That way, it's easier to invest consistently without even having to think about it.

2. Invest in index ETFs

An index exchange-traded fund (ETF) is a collection of stocks, bonds, or other securities bundled together into a single investment. They also track particular stock market indexes, such as the S&P 500, the Dow Jones Industrial Average, or the Nasdaq. In other words, they include all the same stocks as the index they track.

Index ETFs are also hands-off investments, and they perform better when you leave them alone for as long as possible. This makes them perfect for beginners and experienced investors alike. And because each ETF may contain hundreds or sometimes thousands of different stocks, they provide instant diversification and reduce your risk.

Regardless of how much you can afford to invest, index ETFs are a smart option. Many brokers have low or zero minimum balance requirements, meaning there's no minimum amount you need to invest to get started.

3. Buy fractional shares

If you're interested in buying individual stocks but are wary of the high share prices, fractional shares may be the way to go. When you invest in fractional shares, you're buying just a small slice of an individual share of stock -- which means you pay much less than you would by buying full shares.

Fractional shares make even the most expensive stocks affordable. Rather than shelling out hundreds or thousands of dollars for a single share of an expensive stock, you can buy a fractional share of the exact same stock for as little as $1.

With fractional shares, it's also more affordable to build a robust and diversified portfolio. You can easily invest in dozens of different stocks for less than $100, which limits your risk without breaking your budget.

Investing in the stock market doesn't need to be expensive, and it's easier than you may think to find affordable investments. By getting started investing now, you'll be on your way to generating long-term wealth.