Thanks to lawmakers, coronavirus tests are now free for all Americans. But if you do test positive for COVID-19 and require treatment, the hospital bills could easily cost Americans tens of thousands of dollars, even if you have insurance.

Those who are hospitalized with coronavirus can expect to pay anywhere from $42,486 to $74,310 if they are uninsured or if they receive care that's deemed out-of-network by their insurance company, according to recent analysis by independent nonprofit FAIR Health.

For those with insurance who are using in-network providers, out-of-pocket costs will be a portion of $21,936 to $38,755, depending on the cost-sharing provisions of their health plan.

To determine the estimates, FAIR Health drew on its database of over 30 billion private health-care claim records, and on estimates of Medicare and Medicaid costs, to project U.S. costs for COVID-19 patients requiring inpatient stays using diagnosis-related groups associated with pneumonia.

FAIR also ran a slightly different cost analysis of COVID-19 medical care using procedure codes associated with influenza and pneumonia. Using those metrics, FAIR found uninsured Americans with COVID-19 could pay an estimated average of $73,300 for a 6-day hospital stay, while insured patients could expect to pay a portion of the $38,221 average cost billed to insurers.