With almost 40 million people and growing, California is in no danger of losing its spot as the most populous state in the country.

But when it comes to being the top state for having a baby, California is solidly in the middle of the national pack.

A new study by financial advice and credit information company WalletHub ranks California in 21st place out the 50 states and the District of Columbia in terms of best U.S. states to have a baby. The study includes data from organizations such as the U.S. Census Bureau, the Bureau of Labor Statistics and the Centers for Disease Control and Prevention.

According to the accumulated data, for almost every area where California gets a positive score, there is another segment where the state is lacking when it comes to being a place where parents would want to raise their children.

On the plus side, the study puts California in third place for lowest infant mortality rate. The state also came sixth for best parental leave policies, and was ranked No. 8 for low birth weights among newborns.

But when it comes to expenses related to having a baby, and costs associated with newborn children, California passes some serious bills along to new parents.

In terms of overall cost of having a baby, WalletHub said California ranks 51st — in other words, it’s the most expensive state in the country. Among the factors dragging on California’s position are average costs of different types of hospital births, with a conventional delivery averaging $20,242, and a standard C-section costing $34,109.

Then there are the costs than come after the baby is born — when parents go back to work and need someone to watch their kids. In California, that comes to an average annual early childcare fee of $10,192.

In the event you want to hire a babysitter for a night out, you might need to budget accordingly. WalletHub said the average cost of a babysitter or nanny in the Golden State will set you back $18.29 an hour.

The study gave its top ranking to Vermont as the best state for having a baby. Vermont also took first place for total health care, and most pediatrician and family doctors per capita. The New England state tied for first place with Louisiana for most childcare centers per capita, and trailed only Hawaii for the most OB-GYNs and midwives per capita.

At the bottom of the rankings was Mississippi, which came in 51st place overall. The southern state also had the highest infant mortality rate in the country.