Americans will soon be protected from many unexpected medical bills, thanks to a new law that goes into effect Jan. 1.

That legislation, called the No Surprises Act, will greatly reduce the number of unanticipated out-of-network bills that many people are hit with during emergency medical treatment. For example, if a patient finds themselves at a hospital where the anesthesiologist doesn’t participate in their plan’s network, they can be faced with costs in the thousands of dollars even though they had little or no choice in the matter.

One-fifth of emergency claims from private insurers include an out-of-network bill, according to the Kaiser Family Foundation. And 2 in 3 adults fear unforeseen medical costs.

More from Personal Finance:
College enrollment saw largest two-year decline in 50 years
Here are the schools with the best return on investment
Fewer students are going to college because of the cost

Some insurers offer partial out-of-network coverage, but leave the person on the hook for the remaining tab, a practice called balance billing. Other insurers force patients to shoulder the entire uncovered costs.

“These bills are really the epitome of lack of choice combined with high prices that people experience every day,” said Caitlin Donovan, a spokeswoman for the National Patient Advocate Foundation.

Starting in 2022, there will be only a few cases in which a patient can get an out-of-network bill for a medical visit that they believed was covered by their insurer. (Those exceptions include ground ambulances, any non-emergency service treatments at an urgent care facility and if you’ve given informed and written consent for an uncovered treatment.)

In addition, if your doctor moves out-of-network, the law requires that your insurer provide you with at least 90 days of coverage at your previous in-network rate.

The new policy covers nearly all private insurers, as well as plans on the Affordable Care Act’s marketplace. Balance billing is already banned under Medicare and Medicaid.

Come January, people should check to make sure that their medical bills don’t include these out-of-network costs, Donovan said. “If you get a bill and it says somewhere that your insurer paid ‘x,’ and you still owe this much, that should be a red flag,” she said.

The U.S. Department of Health and Human Services is working to create a complaint process for violations of the law, and Donovan said it will be crucial that patients speak up if they suspect they’ve been balance billed.

“Otherwise, providers can continue to bill patients for the full amount and only refund the select few who know their rights,” she said.