Important: The $2 trillion CARES Act wavied the 10% penalty on early withdrawals from IRAs for up to $100,000 for individuals impacted by coronavirus. Individuals will have to pay income taxes on withdrawals, though you can split the tax payment across up to 3 years. If you return the cash to your IRA within 3 years you will not owe the tax payment. 401K and other retirement plans are treated somewhat similarly to IRAs. CNBC published a primer here.
Qualified retirement plans are an important asset for American taxpayers which may allow them to compound wealth for decades on a tax deferred basis. Pulling money out of such an account not only eats principal while stopping compounding, but it can also come with a hefty tax liability as well. For the sake of this calculator, we presume retirement contributions were made with pre-tax dollars. Those types of contributions are typically taxed at the saver's income tax rate & for people who are younger than 59-1/2 there is an additional 10% penalty tax. In many cases this means 1/3 or more of the total withdrawal goes toward income tax payments.
Due to these steep costs (& how Americans & US corporations have drastically underfunded their retirement plans) it is typically better to sell off other assets or use short term financing for temporary needs, while quickly paying off any high-interest debts & not carrying a balance on credit cards from month to month. If one must temporarily carry a credit card balance for a month or two, that is typically going to be less costly than eating early withdrawal penalties by pulling money out of your retirement account prematurely.