It’s a question I often see: I am staying in Taiwan for x hours (with x ∈ [1:24]), what can I do during the layover? The first assumption we are going to make here is you are coming through Taoyuan Airport. If you are one of the rare people who has a leg in another city, feel free to ask in a comment to receive advice. Second assumption, you arrive during Taoyuan MRT opening hours and/or not too late at night.
General opinion about Taoyuan airport
Overall it’s a pretty enjoyable airport. There are various places to eat, rest, shop, or simply roam around. It’s not very big, and going to your gate usually does not take too much time. Just make sure you are at the right terminal. Going through customs is usually pretty efficient, but I noticed sometimes the place gets crowded for no reasons. I would still recommend to be cautious about planning your time and make sure you can make it on time.
If you stay less than six hours
Not much you can do here, apart enjoying the facilities and the free wifi. A lot of boarding gates are designed around a unique theme, it’s a pleasant opportunity to take nice pictures when you are bored. Food is reasonably priced with two notable exceptions: the coffee shops and the halal restaurant.
If you stay more than six hours
Good news, you have time for a very short excursion to Taipei. But you will have to hurry. Take the train to Taipei Main Station (about 45 minutes, don’t forget to take the express) and walk around (bonus if you take a Ubike) a couple of major attractions: 228 Peace Park, Chiang Kai Shek Memorial, the botanical garden (it’s not great, but it’s on the way), Longshan Temple, then head back to your train. Here is a map of the itinerary.
If you stay for longer
Probably a good time to try out one of the night markets. There are several easily accessible from MRT, and since you arrive near the green line, the two easy choices would be Raohe or Guting. Ningxia is also at walking distance from Taipei Main.
Concerning bars/shopping, you have different locations. Ximen is a bit more popular and young (and very gay-friendly), while Xinyi will be a bit more upscale. The latter one has Taipei 101, which has a great observatory to visit during clear days.
If you stay more than twelve hours
You can consider visiting Taipei Zoo and Maokong with the gondola (careful it’s not open during windy days). It’s a bit far, but you have time. In addition to seeing pandas, you can sip some freshly brewed tea while having a beautiful view of Taipei. Pro tip once you are in Maokong: try to walk a bit from the gondola arrival to less frequented places, your experience will be better. For people interested in a nice walk, you can go up elephant mountain and enjoy the most famous Taipei landscape. If you need to rest or take a shower, there are plenty of cheap hotels that can provide a place to stay and charge your batteries.