A new research suggests that being overweight cuts life expectancy by two months for every extra kilo we put in.
At the same time, the study of the genes also revealed that educated people lead a longer life, with almost a year added for each year spent studying beyond school.
Another key finding suggests that people who quit smoking and are open to new experiences might expect to live longer.
The study analysed genetic information from more than 600,000 people alongside records of their parents' lifespan because people share half of their genetic information with each of their parents. The scientists at the University of Edinburgh were able to calculate the impact of various genes on life expectancy.
Lifestyle choices are influenced to a certain extent by our DNA - genes, for example, have been linked to increased alcohol consumption and addiction. The researchers were therefore able to work out which have the greatest influence on lifespan.
"Our study has estimated the causal effect of lifestyle choices. We found that, on average, smoking a pack a day reduces lifespan by seven years, whilst losing one kilogram of weight will increase your lifespan by two months," said Dr Peter Joshi, Chancellor's Fellow at the University of Edinburgh's Usher Institute.
More From This Section
Their method was designed to rule out the chances that any observed associations could be caused by a separate, linked factor. This enabled them to pinpoint exactly which lifestyle factors cause people to live longer, or shorter, lives.
The study found the greatest impact of shortening lifespan which was smoking cigarette and the traits which associated with lung cancer.
For example, smoking a packet of cigarettes per day over a lifetime knocks an average of seven years off life expectancy, they calculated. But smokers who give up can eventually expect to live as long as somebody who has never smoked.
Diabetes also has a negative influence on life expectancy which was linked by body fat and other factors.
The research also identified two new DNA differences that affect lifespan. Firstly, the gene that affects blood cholesterol levels reduces lifespan by around eight months. Secondly, the gene which was linked to the immune system, adds around half a year to life expectancy.
"The power of big data and genetics allow us to compare the effect of different behaviours and diseases in terms of months and years of life lost or gained, and to distinguish between mere association and causal effect," added Professor Jim Wilson.
The research was at published in Nature Communications.