Madrid's budget accommodation scene is genuinely good by European capital standards — you don't have to trade location for price the way you might in London or Paris.
Lavapiés and the southern edge of La Latina consistently offer the best value-to-location ratio — a 15–20 minute walk from Sol at a noticeably lower price point than staying right in the centre. Chueca and the streets around Gran Vía also have a solid mid-budget hostel scene aimed at a slightly older, design-conscious crowd rather than a party-hostel one.
Madrid has a solid range of design-conscious hostels with private rooms as well as dorms — a good middle ground if you want a social atmosphere without committing to a shared room. Budget hotel chains (Ibis, Room Mate's lower-tier properties, and similar) offer a more anonymous but reliably clean alternative.
Budget accommodation sees the biggest seasonal price swings of any tier — a dorm bed or basic double in low season (January, or August despite the heat) can cost half what the same room goes for in May or September.