Weight loss has its share of benefits — lower risk of heart disease or diabetes, better-fitting clothing and boosted energy, to name a few.

But, according to new research from the Johns Hopkins Bloomberg School of Public Health, if you're either obese or overweight, shedding those pounds could save you upwards of $30,000 in your lifetime.

The findings, published Tuesday in the journal “Obesity,” claim 20-, 40- and 50-year-olds would save significant dollars in direct medical costs and productivity losses over their lifetime if they go from obese to overweight or from obese to a healthy weight.

Using previous knowledge that people with a high body mass index (BMI) are more prone to conditions such as diabetes, cardiovascular disease and cancer — all conditions with steep price tags — the researchers created a computational simulation of the U.S. adult population.

The simulation examined adults at various ages, weights and health statuses and then calculated estimated direct medical costs, productivity losses (including sick time).

Here’s how much money you could save by losing weight

Age: 20

Obese to overweight: $17,655

Obese to healthy weight: $28,020

Age: 40

Obese to overweight: $18,262

Obese to healthy weight: $31,447

Age: 50 (cost savings peak)

Average total savings: $36,278

»RELATED: Why this diet praised by Jennifer Aniston could work for you

Though researchers found that cost savings peaked at age 50 and decreased with older ages, they noted that older adults who lose weight can still save money.

In the U.S., more than 70 percent of adults are considered to be overweight or obese. That costs the country nearly $210 billion each year, study authors wrote.

» RELATED: These 9 healthy-sounding foods have more sugar than a Krispy Kreme doughnut

"Over half the costs of being overweight can be from productivity losses, mainly due to missed work days. This means that just focusing on medical costs misses a big part of the picture, though they're a consideration, too," Bruce Y. Lee, executive director of the Global Obesity Prevention Center at the Bloomberg School, said. "Productivity losses affect businesses, which in turn affects the economy, which then affects everyone."

Read the full study and its methodology at onlinelibrary.wiley.com.