If you're planning to have a baby, there are a lot of things you can do to make sure your swimmers are in tip-top shape: Lose some weight (or gain some if you're too thin), cut back on the booze and cigarettes, and eat more walnuts and less saturated fat. But it turns out your lifestyle doesn't just impact whether you can have children; it can affect how those children turn out. A new study suggests that dads getting enough folate before conception is crucial for producing healthy kids.

It's long been known that pregnant women with extremely low vitamin B9, or folate, levels have higher rates of birth defects. The same may follow with men's folate levels during conception. In the new study, male mice were raised – from the womb forward – on either a healthy diet or a low-folate diet, then had pups with a female on a healthy diet. The male mice who hadn't eaten enough folate weren't as fertile as their balanced-diet counterparts. What's more, their offspring were almost 30 percent more likely to have a visible birth defect, like a spinal or facial deformity, than offspring of the mice who ate enough folate.

Researchers found that sperm are sensitive to diet, which has an epigenetic influence on development, metabolism, and disease in the child. For the offspring of mice who didn't get enough folate, the epigenome of many genes associated with development had changed – and it matched well with the birth defects the researchers found. But so had the epigenome of many genes associated with chronic diseases such as diabetes and cancer. The researchers are now following another group of mice for a longer time to see if they develop such diseases down the road.

"Men, just like women, need to start taking care not only of their own lifestyle but of future children they might have," says Sarah Kimmins, a reproductive biologist at McGill University in Montreal who led the study. "Every sperm cell takes three months to develop. If you were thinking about having a baby, you could do everything in your utmost power to live the healthiest lifestyle to ensure that you'll have healthy children."

It's too early to know what the ideal dose of folate is for a dad-to-be, though Kimmins and her colleagues are now studying its effects in humans. But if you're looking to make sure you're getting enough, you'll find folate in leafy green vegetables, dried legumes, nuts, and enriched grain products. And it's worth noting that not everyone gets the full benefit from folate: Men who are overweight or obese can't process folate efficiently, Kimmins says, making it harder to reap the vitamin's benefits – or to pass them on.