There is no "best" travel time in Vietnam, the country can be visited all year long. The climate in different regions of the country is very different. If a region is humid, cold or hot and humid, elsewhere in the country it can be sunny and pleasant. Therefore, we would recommend you to consider the climate when planning your trip. Generally it is actually ok anywhere from December to May, while you should rather avoid some regions in July to November.
Click on the climate table to enlarge
In the North there is a tropical climate with a cool season between November and April and a hot season between May and October. Hanoi and Halong Bay are ok to visit all year long, however in the summer it can be hot and rainy. The best months are March - May, with pleasant temperature and low precipitation.
Also the coast of Central Vietnam (Hue, Hoi an, Nha Trang) is open all year long. In Winter, the temperatures are approximately at 20 degrees and in summer it is hot (30-35 degrees). Between September and December, there are often strong rains, which can place roads under water and limit connections especially in the region of Nha Trang.
The Central Highlands (Dalat, Buon Ma Thuot) is slightly cooler than the rest of Central Vietnam (20-25 degrees and can be visited all year round.) It's somewhat humid and rainy with greater rainfall between June and October.
In the South of Vietnam, it is hot all year long(30-35 degrees) and. The rainy season is between May and October, although the rain is not particularly disturbing – just expect some tropical showers in the afternoon. Even during the rainy season, it is mostly sunny. Best time to visit is November to February: in these months it is almost always dry and slightly cooler.