These are the best states to have a baby, new study finds

Welcoming a baby comes with joy, challenges, and high costs — and a new study ranks the most ideal places in the U.S. to do it.

To determine the best places in the U.S. to have a baby, WalletHub compared the 50 states and the District of Columbia across 31 key measures of cost and health care accessibility, as well as baby- and family-friendliness. 

Their data set ranged from hospital conventional-delivery charges to annual average infant-care costs to pediatricians per capita.

Massachusetts is best state to have baby, according to study

By the numbers:

The data found that Massachusetts was the best state to have a baby, in large part because it has the third-lowest infant mortality rate in the country and the eighth-lowest maternal mortality rate. It also has the best neonatal hospitals in the country (for premature births or babies with health problems).

The Bay State also had the sixth-lowest share of households with infants or toddlers experiencing food insecurity, and the second-highest share of children under three years old with all seven recommended vaccines.

FILE - A baby's feet. (Photo by Silas Stein/picture alliance via Getty Images)

In addition, parents in Massachusetts benefit from the best leave policies in the nation after the birth of a child, according to the study. 

Massachusetts was followed by North Dakota and Minnesota.

What they're saying:

"The best states for having a baby minimize costs while providing top-notch care for both newborns and their mothers," Chip Lupo, a WalletHub analyst, said. "They also continue to be good environments for parents even long after the birth, with high-quality pediatric care, affordable and accessible child care, and a strong economic environment that makes providing for a child easier."

Best, worst states to have a baby

See the full report here.

Massachusetts is also best state to raise a family, study finds

Dig deeper:

Another study, published last year, also found that Massachusetts was the best state to raise a family.

The study, conducted by Birth Injury Lawyers Group, a birth injury law firm, analyzed data from all 50 states on 16 criteria in four categories: health and safety, education and childcare, affordability, and socioeconomics, to find the best and worst states for raising a family.

According to the data, Massachusetts exceled in several key areas. The state received a health and safety score of 82.27, with only 1.5% of children lacking health insurance, and the state boasted a robust network of 117.5 certified pediatricians per 100,000 children.

RELATED: These are the best, worst states to raise a family, study finds

The state also scored high for education and child care and socioeconomics due to its low unemployment rate of 2.9%. 

"Massachusetts sets a high bar for family-friendly living, making it a highly desirable location for families seeking a well-rounded and enriching environment," the law group continued.

The Source: The information for this story was provided by WalletHub, Birth Injury Lawyers Group. This storyw as reported from Los Angeles.

FamilyLifestyleU.S.