In an ideal world, your retirement accounts would be left alone for retirement. You have probably noticed that we are not living in an ideal world.

Early withdrawals can have serious repercussions, including big tax bills today and potential shortfalls in the future. Please look for other solutions first. You might:

Halt ongoing retirement contributions to free up cash; trim expenses; tap other savings and nonretirement investment accounts; sell unneeded possessions; ask lenders for concessions on debt payments, or seek government or charitable help if you can’t pay your bills.

If you must raid your retirement funds, there may be ways to reduce the financial impact. If you are unlikely to pay the money back, your best option may be to take money from a Roth IRA.

If you can pay it back, using the new “coronavirus hardship withdrawal” contained in the Coronavirus Aid, Relief, and Economic Security Act may be your best bet. Here are more details on those options, plus a few more.

Take a coronavirus hardship withdrawal. Savers affected by the pandemic can take up to $100,000 from their 401(k)s and IRAs as part of the recently enacted economic stimulus package. The withdrawal is not penalized and there’s no mandatory withholding. You also have longer to pay the resulting taxes, since the income can be spread evenly over tax years 2020, 2021 and 2022. And if you can pay back the amount you took out within three years, you can claim a refund on those taxes.

These distributions are allowed if you, a spouse or dependent has been diagnosed with COVID-19, the disease caused by the coronavirus. They are also allowed if you have experienced adverse financial consequences from coronavirus-related issues, such as having your hours reduced; being quarantined, laid off or furloughed; not having child care that would allow you to work; owning a business that is closed or reduced its hours; or “other factors as determined by the Secretary of the Treasury,” according to the text of the CARES Act.

Withdraw your Roth contributions. You can always withdraw the amount you contributed to your Roth IRA tax- and penalty-free. It’s only when you start taking out investment earnings that you can incur taxes and penalties. If you have converted a traditional retirement account to a Roth, withdrawals of the converted money won’t be taxable but can be penalized if the conversion is less than five years old.

Take a short-term loan from your IRA. Long-term IRA loans aren’t allowed, but if you have a temporary cash crunch — you have to pay a bill while waiting for your tax refund, for example — the 60-day rule may help. Money taken from a regular, rollover or Roth IRA isn’t taxed or penalized if it’s redeposited within 60 days. You are allowed to do this only once in any 12-month period.

Borrow from your 401(k). You can now borrow up to 100% of your vested balance in a current employer’s workplace retirement plan, up to a maximum of $100,000. Generally such loans are repaid over five years, but the stimulus package allows borrowers to delay payments owed in 2020 for up to one year.

The danger of any retirement plan loan is that you won’t be able to pay the money back. That triggers income taxes as well as penalties if you are under 59½.

Withdraw from your IRA. If you don’t qualify for a coronavirus-related hardship withdrawal, you can still take money from traditional and rollover IRAs. Distributions are generally taxable, and you can be penalized if you are under 59½.

Ask for a hardship withdrawal. If you don’t qualify for a coronavirus-related hardship withdrawal, you may still be able to get a regular hardship withdrawal from your 401(k) or other workplace retirement plan if you can prove an immediate and heavy financial need that requires the distribution. Examples include medical expenses, tuition, a home purchase, funeral expenses and payments to prevent eviction or foreclosure. Hardship distributions are taxable, with a mandatory 20% withholding, and often are subject to 10% early withdrawal penalties.

Each of these options has too many specific rules and exceptions to cover here. Your employer’s human resources department may help you with the details, or you can talk to a tax pro.

Also, talk to a bankruptcy attorney before using retirement money to pay credit cards, medical bills or other debt that could be erased in bankruptcy. Retirement money typically is protected from creditors. It would be a shame to drain your retirement accounts only to wind up in bankruptcy court anyway.