A charitable organization must first be created under state corporate law. The most common options are either a trust or a corporation. Whatever legal entity is ultimately selected, it will be regulated by state law, so it is important that you and your advisors ensure you comply with local filing requirements.
After the organization is formed, its leaders must apply to the IRS for it to be recognized as a tax-exempt charity. For most organizations, this will entail completing a Form 1023. The IRS reviews the 1023 application and determines whether the organization should be considered a 501(c)3 charitable organization, and if so, whether it should be considered a private foundation or public charity. Once the tax exemption is approved, the organization will not have to pay federal income tax and it will be able to accept tax-deductible gifts.