It takes a bus approximately 17-20 hours to travel from Hanoi to Hoi An. However, this 'time' mentioned is not a definite one, as there exist variances pertaining to the bus type, route, and sometimes unanticipated stops on the way. Hence a bus from a reliable company should be chosen and preferably it should be an overnight bus for better comfort.
The distance from Hanoi to Hoi An is within a bracket of 68 kilometers (42 miles). To travel this distance by bus, you can take buses 31 and 520, which ply through the daily routes in between the Old Quarter of Hanoi and the city center, continuing onwards to Hoi An and some of the outlying districts beyond.
Taking route 31 will take you about 45 minutes, while route 520 will take you an hour-and-a-half, depending on traffic and when you start your trip at either ends of Hanoi. Nevertheless, both lines pass by many of the most popular tourist spots and major tourist attractions to be found in Hanoi like the Temple of Literature, Hoan Kiem Lake, and Old Quarter Market.