April 15 is the deadline for most Americans to file their federal and state income tax returns.

There’s no need to panic if you’re not ready yet. The Internal Revenue Service offers a variety of options for procrastinators, from flexible payment options to tax extensions.

You won’t be alone in seeking help, either. Taxpayers submitted 14.7 million tax extension forms last season, according to the IRS.

How to File for a Tax Extension

You should file for an extension by midnight on the tax deadline day if you haven’t finished preparing your taxes. The IRS’s Free File online system allows you to prepare and electronically file IRS Form 4868, the extension application for free. Tax-preparation software, like us here at irs-extension.com, lets you do the same.

An extension will give you until October 15 to file your actual tax return, but not to paying your taxes. You’ll still have to estimate what you owe—and pay the IRS—along with submitting your Form 4868 by midnight on tax day. You’ll need to do the same for anything you owe your state.

The IRS will add penalties and interest to the original amount due if you don’t pay on time. The current annual interest rate is 6 percent, compounded daily.

If you’re expecting a refund from the IRS for the income taxes you already paid last year, there’s no penalty associated with getting a tax extension. However,  the government will hold your money until you file your taxes.

Additionally, the government will keep any refund if you fail to file your tax return within three years of the due date. According to the IRS, Americans will leave about $1.4 billion on the table by not filing for what they’re owed.

Who Gets an Automatic Extension

Some people automatically get an extension to file their taxes without needing an application. Members of the military, eligible support personnel serving in a combat zone, and residents in areas that have been deemed official national disaster areas are all examples of people who get automatic extensions.

Permanent residents living abroad have a two-month extension to file, but they still must pay their estimated tax bill by April 15 to avoid being charged interest.

What’s the Drop-Dead Time to File?

If you’re filing online, your return must be filed before midnight on April 15th, even if the timestamp reads 11:59PM.

You’ll get an email from the tax software company indicating that your return has been filed, which serves as the time stamp. It doesn’t matter if your IRS actually receives your return after midnight.

That said, it’s better to file earlier in the day rather than later.

Sometimes the IRS will reject your return , in most cases due to a typo or math error. The agency will notify you by email, though it may take a day or two.

In that case you generally have a 5-day grace period (referred to as the ‘perfection period’) to resubmit the return electronically. If the IRS rejects a return transmitted on April 15 the taxpayer has until April 20 to resubmit the return, for example.

If you choose not to resubmit the return electronically and instead paper-file the return, you have 10 days after the e-filed return is rejected to file on paper.

Paper returns are considered filed at the time the envelope is postmarked. Ask for a receipt from the postal clerk. Use the U.S. Postal Service’s Postal Locator to find post offices open late on tax day.

What About Contributing to an IRA?

Contributions to traditional and Roth IRAs, as well as SEP-IRAs, other retirement accounts, and health-savings accounts, can be applied to your taxes if they’re made by midnight on April 15. You must indicate that the contribution is for the current tax year.

Customers who transfer money or send it through a mobile check deposit to the investment house will get a confirmation by mail or email. Mobile check deposits will be accepted up to 11:59 p.m. on tax day.

Be sure to note that it’s a “prior year contribution.” Regardless of whether you immediately invest the money or leave it in cash to be invested later, you’ll get credited for the previous tax year, making you potentially eligible for a tax deduction.

The same policy applies to mailed an IRA contribution checks as to mailed tax returns: the date of the postmark is what counts, regardless of the date of receipt.

Remember to also get and retain proof of your postmark if you mail your contribution close to April 15.