Want to donate to a charity? Here’s what you should know.

If you’re thinking about donating, make sure you’re giving to a legitimate group and doing it in a tax-advantaged way.

The American Red Cross hands out clean-up kits to flood victims from one of its trucks near one of the FEMA Disaster Recovery Centers in 2013 in Boulder, Colo.

Melanie Stetson Freeman/Staff/File

December 1, 2016

By Heather Castle, CFP

Learn more about Heather on NerdWallet’s Ask an Advisor.

If you’re thinking about donating money to a charity, there are a few things you should know to make sure you’re giving to a legitimate group and doing it in a tax-advantaged way.

In the race to attract students, historically Black colleges sprint out front

Charities are divided into two types, private and public, depending on their purpose and operations and on how they receive and pay out donations.

Private foundations typically are funded by a wealthy donor or family and often employ family members to run them. These foundations are required to pay out at least 5% of the value of their endowment through grants.

Public charities, which are more common, typically are funded by many donors, including individuals, the government and private charities. Many people give to a public charity because they believe in its mission and want to contribute to its positive impact on society.

Make sure it’s tax-exempt

Public and private charities are set up as nonprofit organizations and receive tax-exempt status from the IRS under code 501(c)(3). Charities get and keep their tax-exempt status by filing documents annually with the IRS showing that their profits are used for “exempt purposes.” These include charitable, religious, educational, scientific or literary purposes; testing for public safety; fostering national or international amateur sports competition; and preventing cruelty to children or animals.

If you’re considering a donation, make sure the charity qualifies for tax-exempt status so you can take a tax deduction for part of your donation. This means you’ll get a percentage of your donation back on your taxes, based on your tax bracket.

Moody chickens? Playful bumblebees? Science decodes the rich inner lives of animals.

Because organizations must file annually with the IRS to maintain their tax-exempt status, they will have a 501(c)(3) determination letter stating they qualify for that status. Before you donate, ask the charity for a copy of its letter to retain for your records. After you donate, the charity should send you a receipt showing the amount of your contribution.

Know the contribution limits

Donations to public charities generally are deductible up to 50% of the donor’s adjusted gross income. Most contributions to private foundations are also tax-deductible, although deductions for some types of private foundations are limited to 30% of the donor’s AGI. Donations to a foreign charity probably won’t be tax-deductible.

It’s always a good idea to speak with a tax consultant or certified public accountant before you decide — IRS rules are complex, and deduction limits can change depending on the type of organization you’re giving to. A professional can help you evaluate your donation and determine which method makes the most sense based on your situation.

Heather Castle, CFP, is the founder of Castle Wealth Advisors LLC in Los Angeles.

This story originally appeared on NerdWallet