Most expensive cities

1. San Jose, Calif. $41,600

2. Santa Cruz, Calif. $38,800

3. New York City $36,700

4. San Francisco $35,900

5. Boston $34,000

6. San Diego $32,700

7. Santa Rosa, Calif. $32,000

8. Oxnard, Calif. $31,400

9. Los Angeles $30,100

10. Washington $29,800

Least expensive cities

30. Raleigh $22,500

31. Salem, Oregon $22,400

32. Charlotte $22,100

33. Phoenix $22,000

34. Austin $21,700

35. Miami $21,300

36. Durham $21,100

37. Houston $19,700

38. Las Vegas $19,500

39. San Antonio $18,700

40. Atlanta $18,500

If you’re planning for a baby, you may also welcome the finding that among the 40 most expensive U.S. cities for caring for a newborn, Atlanta is the least costly.

The online real estate brokerage redfin.com's ranking is based on housing data from multiple listing services and other factors such as average cost of childcare, the costs of an average room in a house, healthcare, baby supplies, toys and utilities in the baby's first year.

The two items driving most of the costs were housing and childcare. The latter information was taken from government and other public sources, redfin said.

It costs about $18,500 to provide for a newborn in Atlanta, compared with $41,600 in the most expensive city, San Jose, Calif. In fact, seven of the costliest cities were in California.

Atlanta’s costs included $4,500 for housing; $5,000 for childcare; $5,600 for baby items; $3,000 for healthcare; and $500 for energy.

After Atlanta, the least expensive cities were San Antonio and Las Vegas.