Hamburg has been ranked as the best night out in the world, beating the likes of New York and Dublin, while London doesn't even make the top 20.

A major new study ranks 41 major cities in 27 countries based on five categories, including the quality of the nightlife, friendliness of the locals, safety, transport and cost after asking local residents their opinions.

And it's Germany's second biggest city that rates best after topping two of the five categories in the survey and rating very highly in the others.

Germany's second largest city, Hamburg, which has been rated as the world's best night out by new research

It is praised for having open and friendly people and excellent transport links moving people between key destinations.

The quality of its nightlife also rates highly based on the nocturnal activities available and people's general enjoyment.

Other highly rated cities include Copenhagen, which came in second, as well as Berlin (third), Dublin (fourth) and Amsterdam (fifth).

The rest of the top ten is comprised of San Francisco, Gothenburg, Prague, Warsaw and New York.

A table showing how major cities around the world were ranked when it came to the five factors that make a good night out

San Francisco and New York are the only non-European cities to make it into the top ten.

However, major cities such as London, Tokyo and Rome fare badly in the research with all three failing to make it in the top 20.

Tokyo is slammed for its poor transport links and value for money, London also scored badly on affordability, while Rome is criticised for being difficult to get around.

The research, carried out by online hostel booking service HostelWorld, also found the cost of a typical night out varies a great deal across the world with the cheapest cities named as Prague, Warsaw, Pretoria, St Petersburg and Mumbai.

Second cities beat major cities in almost every country - Hamburg beat Berlin, San Francisco beat New York, Milan beat Rome and Pretoria beat Johannesburg.

These scored better because they are often seen as more compact, convenient and cohesive for a single night out, allowing citizens to enjoy a range of activities without having to travel all over town.

New Yorkers are the most certain they have the best night out when asked the question directly.

Within the categories, New Yorkers rate their city very highly for food and drink, and fairly well for getting around, but below average for safety, affordability and friendliness.

The Danish capital Copenhagen came in second and most people said it was one of the safest cities for a night out

Berlin, pictured, came third in the research and was closely followed by Dublin and Amsterdam

THE BEST PLACES IN THE WORLD FOR A NIGHT OUT 1 Hamburg 2 Copenhagen 3 Berlin 4 Dublin 5 Amsterdam 6 San Francisco 7 Gothenburg 8 Prague 9 Warsaw 10 New York 11 Stockholm 12 Helsinki 13 Madrid 14 Boston 15 Pretoria 16 Shanghai 17 St. Petersburg 18 Toronto 19 Mumbai 20 Paris 21 Barcelona 22 Vancouver 23 Chicago 24 Delhi 25 Jakarta 26 London 27 Kuala Lumpur 28 Sydney 29 Istanbul 30 Bangkok 31 Moscow 32 Milan 33 Mexico City 34 Sao Paulo 35 Johannesburg 36 Beijing 37 Seoul 38 Rio de Janiero 39 Rome 40 Ankara 41 Tokyo Advertisement

Globally, northern Europe scores very highly - it contains 10 of the top 12 top cities.

Marek Mossakowski, Global Head of Brand at Hostelworld, said: 'The results of this study have been fascinating, especially the performance of smaller cities – most notably with Hamburg taking top spot over Berlin.

'We know young travellers are increasingly venturing off the beaten track to uncover unique experiences, and this study demonstrates this.'