HSH.com looked at how much income you need to buy a median-priced home in 25 of the country’s largest metro areas and not surprisingly, the San Francisco Bay Area came out on top.

To cover principal and interest alone on a median-priced home in the greater Bay Area ($682,410), you would need $115,510 in annual income. The monthly payment would be $2,695.23. To also cover taxes and insurance, you would need more, but the study did not factor those in because they vary widely by city.

The study used the average mortgage rate in each metro area. It took median home prices from National Association of Realtors data for the fourth quarter. It subtracted a 20 percent down payment from the median home price and assumed the buyers would spend 28 percent of gross income on monthly principal and interest payments. That is the maximum “front end ratio” Fannie Mae and Freddie Mac usually accept on loans they guarantee. If you also include taxes, insurance and payments on other debt, Fannie and Freddie generally will go up to 36 percent of income.

“There is no doubt that your income will need to be much higher, possibly even double or triple this level, to cover the needed taxes, insurances and other expenses to live in the home, plus the down payment and any other debts you might have. Since those are highly variable, down to even the individual property level and personal choice, there is no adequate way to factor for them,” HSH says.

The only thing about the study that surprised HSH Vice President Keith Gumbinger is that the median price in the Bay Area fell 3.2 percent from the third to the fourth quarter (although it was up 15 percent on a year-over-year basis). That means the average income needed to buy a home in the Bay Area fell by $9,562 from the third to the fourth quarter.

The Bay Area includes the San Francisco, San Jose and Oakland metro areas. Detroit and Pittsburgh were not included in the report because they do not report home prices to the Realtors association, Gumbinger says.

Here is the full list of income needed to buy a home in 25 metro areas in the fourth quarter, from most to least affordable:

1. Cleveland: $19,435.17

2. Cincinnati: $22,226.95

3. St. Louis: $22,397.54

4. Atlanta: $24,390.94

5. Tampa: $24,650.88

6. Orlando: $28,298.47

7. San Antonio: $29,305.47

8. Dallas: $29,751.24

9. Houston: $31,298.99

10. Chicago: $32,388.90

11. Phoenix: $32,811.94

12. Minneapolis: $33,800.09

13. Philadelphia: $36,836.47

14. Baltimore: $41,155.40

15. Sacramento: $42,832.20

16. Miami: $43,918.66

17. Portland, Ore.: $45,872.78

18. Denver: $48,122.72

19. Seattle: $59,129.86

20. Washington, D.C.: $62,809.63

21. Boston: $63,673.13

22. New York City: $66,167.27

23. Los Angeles: $72,126.90

24. San Diego: $81,570.40

25. San Francisco: $115,510.06

Contact Kathleen Pender at kpender@sfchronicle.com. Twitter: @kathpender Facebook: facebook.com/kathleen.pender.94

Despite its high prices, San Francisco ranked high on a list of America’s top cities of 2013 by Movoto. Check out their top 10 below.