The 10 most-expensive cities to raise kids in the U.S.—it costs nearly $40,000 a year in San Francisco

A child will cost you $30,000 annually in some of the biggest U.S. cities.

The 10 most-expensive cities to raise kids in the U.S.—it costs nearly $40,000 a year in San Francisco

It's no secret that kids are expensive, but where you raise them can add thousands to your annual budget.

The average yearly cost of raising a child across the 100 most-populous U.S. metros is $22,989, but it can vary widely between cities, according to an analysis by Creditnews Research.

In San Francisco, the annual cost of raising a child is $37,340, the highest of all cities. In contrast, it's only $14,661 in Jackson, Mississippi — a difference of just under $23,000.

The average cost of raising a child until the age of 18 across all 100 cities is $413,810, according to the study.

The estimates are based on the average extra costs that two working parents would be expected to pay in a given year, based on Department of Labor data. For one child, these expenses include child care, food, housing, health care, transportation and other necessities.

Unsurprisingly, cities with the highest child-related costs have some of the highest housing costs in the country, with housing being the biggest expense in a family's typical household budget, according to the study. 

This suggests that the spillover effect of high housing costs can affect whether people who live in large cities can comfortably afford a family. In many large cities, the annual cost of having one child is just under half the current U.S. median household income of $79,090, according to Motio Research.

Here's a look at the 10 least affordable metro areas for raising children, according to Creditnews Research.

1. San Francisco

Average annual cost of raising a child: $37,340Total cost of raising a child until age 18: $672,120

2. San Jose, California

Average annual cost of raising a child: $37,305Total cost of raising a child until age 18: $671,490

3. Boston

Average annual cost of raising a child: $35,236Total cost of raising a child until age 18: $634,242

4. Bridgeport, Connecticut

Average annual cost of raising a child: $33,267Total cost of raising a child until age 18: $598,800

5. San Diego

Average annual cost of raising a child: $32,763Total cost of raising a child until age 18: $589,728

6. New York City

Average annual cost of raising a child: $32,115Total cost of raising a child until age 18: $578,070 

7. Oxnard-Thousand Oaks-Ventura, California

Average annual cost of raising a child: $31,615Total cost of raising a child until age 18: $569,064

8. Los Angeles

Average annual cost of raising a child: $31,459Total cost of raising a child until age 18: $566,268

9. Denver

Average annual cost of raising a child: $31,122Total cost of raising a child until age 18: $560,190

10. Honolulu

How this millennial making $65,000 in Houston, Texas spends her money