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