Retirement tax questions

You always pay tax on 401(k) withdrawals, because the contributions were never taxed.  Sometimes, you can be exempt from the 10% penalty for early withdrawal.  The list of available exemptions is here.  There are no general exceptions for "hardships", but maybe some of your expenses fall into an allowable category.

https://www.irs.gov/retirement-plans/plan-participant-employee/retirement-topics-tax-on-early-distri...