I have a layover in Madrid from 4:20pm to next day 12:45am. Is it feasible to go into the city for the evening?
Yes, there are several forms of transportation available (subway, bus, and train I believe) from the airport into the city. Which you choose would depend on where you want to head first. I don't know whether there is a place to leave your carry-on luggage (if any) at the airport, but I believe there is such an option at the Atocha rail station. However, checking and retrieving luggage could significantly eat into your sightseeing time.
One thing to keep in mind is that Spaniards eat dinner extremely late, so it may be difficult to have dinner at a non-touristy restaurant and get back to the airport on time. Do you have a transatlantic flight requiring you to check in 3 hours in advance, or will 2 hours be sufficient?
You do not mention where you are coming from, or going to, but the layover is not as long as you might think. If coming from the US, you have immigration, plus just walking from Point A to Point B in the Madrid airport seems to take ages. The metro or bus into central Madrid you can figure a half hour. then travel back with plenty of time to get through security. Still you could figure a good 4-5 hours in central Madrid.
Given that time of day, you probably would have enough time to wander around Plaza del Sol and Plaza Mayor, look at the shops, visit a few Tapas bars, maybe Mercado San Miguel, wind up with some churros con chocolat and head back to the airport.
Coming from Morocco and heading back to the US. Not looking forward to spending 22 hrs in an airport!
Yes! Layover is from 4:20pm to 12:45pm. Sorry for confusion! I always try very hard to only take carry-on when I travel. So hopefully no waiting for bags.
What month is this trip?
November. Two weeks in Morocco. Can’t wait!
It looks like the Prado Museum is open until 8 except on Sundays. You must enter by 7:30.
There are direct trains every 30 minutes (at least in the afternoon) from the airport to a station close to the Prado, so I'd do that right away, then enjoy paseo around the Puerta Del Sol/Plaza Mejor/Palace before getting a typically late dinner and enjoying a coffee or drink afterwards. Or instead you could take an evening walking tour followed by dinner or tapas-bar hopping.
The tricky part will be if you're not an all night kind of person. Bars and clubs stay open quite late, in some cases all night, but public transit does start to become more difficult after midnight. There are night buses, including to the airport, but they run infrequently so have a good idea of where you want to finish the evening at and what your night bus options are from there to the airport so you can return by morning and have time to freshen up and catch your flight.