It's widely known that kids are costly. But when it comes to the budget breakdown for raising a baby, it varies vastly by state.

Personal finance site Magnify Money recently crunched the numbers to determine the cheapest and most expensive states in which to have a baby. For each state, the study looked at factors including the difference in cost between renting a typical one bedroom and two bedroom apartment; the average cost of daycare; the average cost of baby apparel, diapers and wipes; average additional food costs; the average cost of adding a dependent to workplace health insurance; and federal tax credits. It also looked at those factors across the 100 largest metros in the U.S.

According to that data, the average monthly cost of raising a baby across all 50 states is $1,037. But more localized numbers showed Massachusetts is the most expensive state to raise a baby, with an average cost of $1,521 a month. That's nearly $800 more than the cheapest state to raise a baby, Arkansas, which has an average monthly cost of $723, the study found.

Magnify Money also found that overall, there is an average rent difference of $175 a month between one to two bedroom apartments; an average monthly cost of $744 for daycare; an average monthly cost of $56 for baby apparel, diapers and wipes; additional food costs average $52 monthly; and the average cost of adding a dependent to workplace insurance is $176 monthly. For 2018, parents can get up to $2,000 federal tax credit per qualifying child.

According to Magnify Money, the 10 most expensive states to raise a baby, and the total monthly costs are:

1. Massachusetts: $1,521

2. Hawaii: $1,464

3. Washington, D.C.: $1,374

4. California: $1,349

5. Connecticut: $1,327

6. Alaska: $1,314

7. Vermont: $1,311

8. New Hampshire: $1,290

9. New Jersey: $1,243

10. Maryland: $1,238

According to Magnify Money, the 10 cheapest states to raise a baby, and the total monthly costs are:

1. Arkansas: $723

2. Mississippi: $759

3. West Virginia: $814

4. Tennessee: $830

5. Louisiana: $835

6. Alabama: $837

7. Utah: $850

8. South Carolina: $850

9. Kentucky: $870

10. North Dakota: $872

The cost of raising a child in the United States is soaring. In July, CNBC reported that child-care costs have jumped for the fifth straight year, according to a survey from Care.com. A previous report from the United States Department of Agriculture also found that the 2015 estimate for child-rearing expenses from birth through 17 years old in a two-child, middle-income, married-couple family climbed to $233,610.

And costs are a big factor in a decline in fertility in the U.S. Earlier this year, the New Times surveyed nearly 2,000 young men and women on why they had or expected to have fewer children than they considered ideal; 64 percent cited child care being too expensive as a factor. And in Colorado (ranked eighth in the nation for the largest fertility rate decline), the Denver Post surveyed 350 millennials who decided not to become parents and nearly half said the prevailing factor was finances.

You can find Magnify Money's full study and methodology here.

Don't miss: 10 best foodie cities in America (No. 1 may surprise you)

Like this story? Subscribe to CNBC Make It on YouTube!