The Bavarian city of Munich came in second, attracting 15 percent of people, while the capital Berlin was only third with 11 percent.
It was bad news for Essen in the Ruhr region of North Rhine-Westphalia, which – despite being named European Capital of Culture in 2010 – emerged as the least popular city.
The top cities also seemed to polarise opinion however. As well as choosing their favourite city, respondents were asked to list the city where they would least like to live. Berlin was the most maligned, with 15 percent describing it as the worst place to live. Munich was fourth least-desirable, following Frankfurt am Main and Lepizig.
Age had an impact too. Among the under-25s, Berlin was the most desirable city, while older people favoured Hamburg and Munich. Respondents tended to stick to what they knew too. People were more likely to list cities in their vicinity as most desirable. Among those living in North Rhine-Westphalia, Cologne was the second most popular city after Hamburg and among Bavarians, Munich was number one.
The survey did have some limitations though. Respondents were only given a choice of 14 cities, each of which had a population of more than half a million. Examples of smaller cities excluded from the list include Bochum, Bonn and Mannheim. Respondents were therefore not able to choose to live in the countryside or in a smaller town.
The survey was carried out online by research agent YouGov and questioned 1,304 people over the age of 18.