Bonds have often been the wary investor's substitute for a nice, safe mattress.

It's no wonder Americans are piling into bonds as the stock-market benchmark S&P 500 has fallen 19% so far this year and financial firms, including Washington Mutual (WM) - Get Waste Management, Inc. Report ( STOCK QUOTE: WM) and Morgan Stanley (MS) - Get Morgan Stanley (MS) Report ( STOCK QUOTE: MS), have lost more than half their value.

In recent weeks, though, even the bond market has started to look scary because of the government's planned bailout of companies infected with subprime securities, which could cause prices to fall. But not all bonds are alike. While some are virtually risk-free, others are quite volatile. Before you dip your toes into the bond market, it's a good idea to learn a few simple ins and outs of investing in fixed-income securities.

The Skinny on Bonds

Simply put, a bond is a loan. You can loan money to the government, a governmental agency or a corporation by buying their bonds. In return, those institutions pledge to pay you back by a certain date, and to pay you interest on that loan. That interest is paid in regular installments, and the amount of those payments is called the yield.

Say you invest $1,000 in a 10-year Treasury bond with a 3.85% yield, the going rate in late September, according to the U.S. Treasury. The federal government promises to pay you back that principal investment of $1,000 in 10 years, and also to pay you $38.50 a year -- 3.85% of your principal -- in interest, or yield.

TheStreet Recommends

And though bonds can't match the performance potential of stocks, investors can see modest growth among their fixed-income holdings. That's because high demand for bonds -- whether because of a flagging stock market or the promise of high yields -- can boost prices. While you spent $1,000 on that 10-year Treasury note with a 3.85% yield, investors may be willing to pay you more than $1,000 to get that yield. If you sold the bond, you would reap a return on your original investment. In short, the bond would offer you a capital gain much like that of a rising stock.

It's All in the Ratings

Treasury bonds are almost risk-free because they're backed by the full faith and credit of the U.S. government. But not all bonds are as safe. The best indicator of a bond's risk is its credit rating. Companies, including Standard & Poor's and Moody's, evaluate an institution's financial strength, and then attach grades to its bonds to rate how likely that institution is to pay investors back.

The top rating is AAA, meaning the bond offers the maximum safety. Bonds rated below BBB are said to be below investment grade, sometimes called "junk" bonds. Such bonds carry much more risk than AAA-rated Treasury bonds, but offer much higher yields to entice investors to take on that additional risk.

A Tool in the Toolbox

Bonds can be a great tool for diversifying your portfolio. Most investors hold the bulk of their savings in equities, because the stock market offers lots of growth potential. But stocks also can be volatile. When stocks are on the downturn, bonds' stable performance can help smooth out returns in your portfolio. What's more, interest payments can offer regular cash flow to help you meet short-term financial needs.

Best of all, having a portion of your portfolio invested in bonds can help you sleep more soundly, as you're secure that at least some of your savings won't tumble into the red, due to a shaky market.