Even if you don't know much about investing, you probably have a baseline knowledge that a portfolio should be diversified between stocks and bonds, and that the right proportion of stocks to bonds depends on your age and risk tolerance. But do you know why?

It's all about the balance between risk and reward. Stocks and bonds are two different classes of investments, and they have certain features that work for or against you in different ways. Here's a closer look at both of these asset classes and why they belong in your portfolio.

Risk and reward scale drawing

Image source: Getty Images.

What are stocks?

When you purchase shares of a company's stock, you're buying a portion of that company, essentially becoming a part-owner. How much you own depends on how many shares you own, compared to the total number of shares held by everyone else. For example, if a company has one million shares and you own one, then your ownership stake is 1/1,000,000, or one one-millionth of the company.

Stocks generate income in two ways.

First, when the company is doing well, its stock price goes up, which means the value of its shares increases. If you buy and hold a stock that appreciates over time, you will make money when you sell it because you sell at a higher price than for what you paid for it. For example, if you buy one stock at $100 a share, and two years later it's worth $200 a share, you've doubled your money, making a profit of 100%.

Another way investors get income from stocks are through dividends, which are regular distributions some companies pay to shareholders. But even dividend-paying companies don't guarantee they will keep paying the dividend, because it's subject to how the company performs.

There are two main types of stocks: common and preferred. Common stocks give shareholders the right to vote on a company's policies and its board of directors. Preferred stocks usually don't include any voting rights, but these shareholders receive payouts and dividends before the common shareholders, so there's a smaller chance you'll lose your investment if the company goes belly up.

Stocks are riskier investments than bonds because if a company's stock value drops, you could lose a lot of money and if the company goes under, you could lose everything you invested. Stocks are known for being volatile in the short term, but over the long term, they've historically generated higher returns than bonds. Since 1926, stocks have grown by an average of 10% per year, while bonds have grown by an average of only 5% to 6% per year, according to Morningstar.

What are bonds?

Bonds are debt. Bondholders essentially lend money to the entity that issued the bond, with the understanding it will be repaid, with interest, over a certain period. You can purchase bonds from companies (corporate bonds) or from federal governments (Treasury bonds, or T-bonds) and municipalities (muni bonds).

You earn money when the entity pays you interest. If you have a $1,000 bond with a 4% annual interest (or coupon) rate, you receive $40 per year (4% of $1,000) until the bond matures, or expires. On top of the interest payments, the entity repays the face value of the bond over the set time period, until it completes its obligation to you.

You aren't required to hold the bond until its maturity, though. You can sell the bond through a broker at any time. The amount of money you make (or lose) will depend on the bond issuer's circumstances and interest rates. If the bond issuer is on the verge of bankruptcy, you will probably lose money because other investors aren't thrilled with its prospects of repaying. But if the bond issuer is doing well, you'll probably turn a profit. Similarly, when interest rates are low, other investors want to buy bonds with a higher interest rate so they can get a higher return, but when interest rates rise, you may have to take a loss to sell your low-interest bond.

Bonds are usually considered safer than stocks because you're more likely to get your money back and then some. As long as you hold the bond, you will receive a fixed sum every year unless the entity declares bankruptcy, a much more likely scenario in the corporate bond world than government-issued bonds. Even if the company does go under, bondholders are first in line to be repaid, before preferred stockholders.

But bonds are not without risk. Companies can default on their bond payments. Agencies like Fitch Ratings and Standard & Poor's rate the creditworthiness of various organizations to determine how likely they are to pay back their debts. High-yield, or junk, bonds are bonds for companies with low credit ratings. These usually have higher interest rates, but there's a greater chance that you could lose money if the company defaults, so these bonds are too risky for most investors.

Interest rates can also wreak havoc on the value of bonds, even if you hold them until maturity. Imagine that you purchase a bond with a 4% interest rate. You'll make money in the long run if the rate of inflation stays below 4% over the life of the bond. But if inflation rates rise to 5%, you're locked in at that lower 4% interest rate and you'll actually lose money over the long run.

Get started investing

It's best to have a mix of stocks and bonds in your portfolio, but the exact ratio will depend on your personal preferences and your age.

Generally, people closer to retirement should be more conservative by investing more in bonds, to ensure you don't lose all your savings. But when you're younger, you may be better able to weather the ups and downs of the stock market, so a stock-heavy portfolio gives you an opportunity to earn greater returns.

You can buy stocks and bonds through a brokerage firm. You can also buy bonds directly from the entity issuing the bond. If you're interested in a U.S. Treasury bond, for example, you can purchase them on the U.S. Treasury website.

Another option is to buy stocks and bonds through a mutual fund or an exchange-traded fund (ETF). These funds are popular because they're essentially baskets of many stocks and bonds, offering instant diversification and saving you the trouble of purchasing a bunch of stocks and bonds on your own.

Be mindful of the fees on whatever you invest in. Most brokerages charge a commission every time you buy or sell an asset. Mutual funds and ETFs charge expense ratios as well. These are annual fees -- usually charged as a percentage of your assets -- that shareholders pay to cover the fund's operating expenses. Ideally, you don't want to pay more than 1% of your assets per year. You can determine how much you'll pay in fees by checking the brokerage firm's fee schedule and looking at the prospectus for the investments you're interested in.

If you're not sure what to invest in or how much of your money should be in stocks and how much in bonds, consider consulting a financial advisor who can advise you on the best options for your financial goals.