It's no secret that smoking, poor diet, lack of physical activity, and too much alcohol consumption can be bad for your health, but a recent study by the Ottawa Hospital has come up with a way to measure the price of bad health behavior in years.

published Tuesday in the health journal PLOS Medicine . Stay away from junk food - it can shorten your life, according to Ottawa Hospital study. (Chris Young/The Canadian Press) On average, unhealthy habits are costing Canadians an estimated six years of life, according to a study

"Unhealthy behaviours place a major burden on Canadian life expectancies," said Dr. Doug Manuel, senior scientist at the Ottawa Hospital and lead author of the study, which identifies the major risk factors that lead to premature death.

With the new research, the hospital has updated its online calculator called Project Big Life to determine the impact of lifestyle choices on how long a person can expect to live.

Dr. Manuel and his team created the tool to help Canadians estimate their own life expectancy.

The study found that of all deaths:

26 per cent are attributable to smoking.

24 per cent are attributable to physical inactivity.

12 per cent are attributable to poor diet.

0.4 per cent are attributable to unhealthy alcohol consumption.

Regular exercise is a contributor to longer life expectancy, according to study by the Ottawa Hospital. (Paul Chiasson/The Canadian Press) Researchers found that for men, the greatest health risk was smoking, and for women, it was lack of exercise. In all, poor health habits contributed to approximately 50 per cent of deaths in Canada, according to the study.

But there was also good news in the study for people making healthy choices. Regular exercise, good nutrition, and no smoking increased life expectancy.