This is one of the most commonly asked questions that people have when they start planning their trip. We here it asked again and again in emails to us and in the various travel forums. It's difficult to give a simple absolute answer, but we'll do our best to share our advice based on our years of hostel travel experience.
If you know your trip's itinerary in advance, it's probably best to go ahead and book your hostels as soon as you have your final plan for what city you want to be in for each night of your trip. If you book your hostels at least 1-2 months in advance, you'll almost always be able to find available beds at even the best top rated hostels. (By "top rated", we mean hostels that have a high Hostelz.com Combined Score, since those tend to be the most popular hostels.)
What if you can't book that far in advance? Even in the high season (in Europe that means June - August), you can usually still find available beds at most of the top rated hostels if you're booking at least a week in advance. Occasionally some popular but small hostels might start filling up. But in most cases, most hostels will still have some available beds a week before, especially for weekday nights.
What if you don't want to plan your trip in advance, and want to keep your options open for where ever your travel adventure takes you? Don't worry, you can make that work too. What we recommend is that you at least book your first hostel at your arrival city well in advance. And then as you continue your trip, try to book your next hostel at least 2-3 days in advance.
When we arrive in a city, we usually get a sense of how long we'll stay after the first day. So we'll usually make plans for our next city after that first day.
Doing it this way means that you may not always be able to find beds at the very most popular hostels in some cities, but you'll almost always be able to find a decent one at least. Worst case, you may find that the hostel you want is full for a couple days and you may need to adjust your plans a bit and stop in a between city or stay in your current city for a little longer. But that's all part of the adventure of spontaneous travel right? If you're willing to compromise sometimes, you can make it work.
You do have an advantage if you're using Hostelz.com to make your bookings (you are using it for all your bookings right?). Hostels typically only put a portion of their beds in each of the booking systems. So a hostel may be "sold out" on most booking sites, but still have a few beds left on another booking website. But Hostelz.com is the only site that searches all of the hostel booking websites. So by using Hostelz.com, you'll always be able to find even that last available bed at the very best hostel.
Watch out for holidays, festivals, and special events. If you're planning to attend Oktoberfest, the Running of the Bulls, or La Tomatina, that changes everything. For some of the popular events you may need to book a hostel as much as 6-12 months in advance. Holidays such as New Year's Eve can mean full hostels in many countries all over the world. So watch out for holidays and events of all kinds, and consider booking farther in advance if there's something on the calendar when you plan to be in town.
People on vacation often forget about weekends. After-all, when you're on vacation a weekend feels pretty much the same as a weekday. But don't forget that people who live in the region you're visiting are more likely to make their trips on the weekend. So pay attention to the calendar, and book a little further in advance for Friday and Saturday night accommodations.
The above advice was based on the assumption that you're booking dorm beds. If you're looking for private rooms at hostels, be aware that hostels usually only have a very limited number of private rooms. That makes sense, because they can make a lot more money off of a room full of dorm beds than they can from having a lot of private rooms. Even larger hostels sometimes only have a few private rooms, if any. So be aware that you'll need to book further in advance if you want a private room at a hostel.
If your trip is more than a year away, it's too early to start making bookings because most hostel booking systems won't let you book more than a year in advance. But if your trip is less than 12 months away and you're sure of your plans, then it's not too early to start making bookings if you would like.