NEW YORK (TheStreet) -- Have you always wondered whether it makes sense for you to buy municipal bonds? The following calculations should help you figure it out.

The basic question is: Is your after-tax return on taxable bonds better than your tax-free return with munis? If you live in a state without an income tax, you've got it easy.

#### No State Income Tax in Your Equation

First, determine your federal tax bracket; say it's 28%. So you're shaving 28% off your yield on a taxable bond. If the tax-free muni bond yield is less than 28% lower than the yield on a taxable bond (e.g., say it's 27% lower), you're better off with the muni bond.

Here's an example: Let's say a 30-year Treasury bond is yielding 4.62%, and the yield on a 30-year insured muni bond is 4.21%.

Forget reaching 28% -- the muni yield is only 8.9% lower than the Treasury yield, making the muni the obvious choice. Looked at another way, your after-tax yield on the Treasury (28% lower) would be just 3.33%. To beat the muni, you'd need a taxable yield of at least 5.85% (4.21%/(100%-28%)).

The federal income tax calculation alone usually determines whether a given investor should buy municipal or taxable bonds, even if the investor is choosing between munis and investment-grade corporate bonds, which yield more than Treasuries. (Note: More and more muni bonds come with insurance, which guarantees on-time interest and principal payments and provides a triple-A rating.)

Going back to 1986 -- the last time tax reform caused a major repricing of municipal bonds relative to taxables -- the yields on A-rated municipal bonds have been 20% to 30% lower than the yields on A-rated corporates; they have averaged 26% lower. This means that if you were in at least the 28% Federal tax bracket, you still would have done better on average with munis than with corporates.

#### If You Pay State Income Tax

If you live in a state with income tax, the process of choosing between municipal and taxable bonds is a little more complicated. In general, you don't pay state tax on munis issued in your state, and Treasuries are not taxed at the state level.

The chief benefit of buying munis outside of your state is diversification. A national muni bond fund is going to be more diverse than a single-state fund. But if you're in a big state, you probably don't need to look beyond your borders in order to diversify.

There are four main comparisons you might make:

#### 1. State-Issued Municipal Bonds vs. Treasury Bonds

The simple calculation described above is all you need to do. Because neither investment generates income that's taxable at the state level, it's as if you lived in a state without an income tax.

#### 2. Outside-State Issued Municipal Bonds vs. Treasury Bonds

The muni yield is taxable at the state level, the Treasury yield isn't. So to do an apples-to-apples comparison, you need to adjust the muni yield for state taxes and the Treasury yield for federal taxes.

If you don't deduct your state tax payment from your federal tax bill, you can simply lower the Treasury yield by your federal tax rate and the muni yield by the state tax rate.

If you do deduct, lower the muni yield by your effective state tax rate, which is your state tax rate adjusted downward by your federal rate. Example: Your federal rate is 28% and your state rate is 6%. Your effective state tax rate is 6% lowered by 28%, or 6% - (0.28 x 6%) = 6% - 1.68% = 4.32%. So you'd lower the Treasury yield by 28% and the muni yield by 4.32%, then compare the two.

#### 3. State-Issued Municipal Bonds vs. Corporate Bonds (or Agency Bonds)

The munis are totally tax-free, the other bonds are taxable at all levels. You need to adjust the taxable yield for all taxes. If you don't deduct your state taxes from your federal taxes, then lower the taxable yield by the sum of your federal and state rates. If you do deduct, lower it by the sum of your federal and effective state rates.

If you're comparing munis to a U.S. government bond fund, which contains both Treasury and agency bonds, only a portion of your earnings will be subject to state income tax.

Unless a fund observes limits on how much of its assets it will invest in non-Treasury bonds, you can't know for sure how it's going to affect your tax bill, but the fund company should be able to tell you how the manager has allocated the fund's assets historically.

Apply this calculation to the portion of the fund's dividend you expect to be state taxable, adjusting the rest for federal taxes only. Say, for example, a fund historically has paid out income 25% of which is tax-free at the state level and 75% of which is fully taxable.

With a federal rate of 28% and a combined federal and state rate of 4.32%, you'd need to lower the fund's yield by 31.2% to do a fair comparison with munis issued in your state.

Here's the math:
(0.28 x 0.25) + ((0.28 +0.043) x 0.75) =
0.07 + (0.323 x 0.75) =
0.07 + 0.24225 =
0.31225 = 31.2%

#### 4. Outside-State Issued Municipal Bonds vs. Corporate Bonds (or Agency Bonds)

The munis are taxable at the state level, the others are taxable at all levels. If you don't deduct, lower the muni yield by your state rate and the taxable yield by the sum of your federal and state rates. If you do deduct, lower the muni yield by your effective state rate and the taxable yield by the sum of your federal and effective state rates.

If, as above, you're looking at a U.S. government bond fund, apply this calculation to the portion of its income you expect to be state taxable, adjusting the rest for federal taxes only.

Have you decided you're a muni buyer? Then you're done -- almost done. You still need to think about the alternative minimum tax. But we'll tackle that in another story altogether.

More on Bond Investing: Types of Bonds | Bond Basics