The short answer is: It depends who you ask. Some authorities say Hanukkah candles may be extinguished after burning for the minimum of 30 minutes, others say they should not be extinguished at all.
Lighting candles is the central mitzvah, or commandment, of Hanukkah. This is because Hanukkah celebrates the miracle that a small band of Jewish fighters, called the Maccabees, drove the Greek usurpers out of Jerusalem and reclaimed the Jewish Temple. Upon rededicating the Temple, the Maccabees found only one jar of sacred oil with which to light the menorah. It was expected to burn for only a single day, but ended up lasting eight days, which is why Hanukkah candles are lit for eight consecutive nights. That oil miraculously burned longer than expected, but is it OK to artificially shorten the burn time for your commemorative lights?
Hanukkah candles are lit after sunset, ideally immediately after, and displayed publicly if it is safe to do so. To fulfill the mitzvah, they should contain enough fuel (wax or oil) to last for a minimum of half an hour, though it is considered a beautification of the mitzvah if they burn longer. All sources agree that ideally they are not extinguished and allowed to go out naturally.
But what happens if you light your Hanukkah candles and then need to go out? Leaving unattended lit candles can be a fire hazard and according to the Jewish principles of pikuach nefesh (saving a life) and bal tashchit (not causing wanton destruction) one should not create a dangerous situation. The best choice, if you know you’ll need to go out, is wait and light your candles later. Candles can be lit well past sunset if necessary. However, if the candles have already been lit, the next best choice is to allow them to burn for a minimum of half an hour and then extinguish them. This is the course of action suggested by the Shulchan Aruch, Judaism’s premier law code:
Therefore one must place enough oil for that time (30 minutes), and if one put more oil in, one may extinguish the candle after that time has passed, and may use the light after that time.Shulchan Aruch, Orach Hayim, 672:2
In truth, most Hanukkah candles these days do not burn much more than 30 minutes anyway. This ruling therefore applies more to people who are lighting oil lamps with enough oil to last much longer or using extra large Hanukkah candles.
It should also be noted that there are some halakhic (Jewish legal) authorities who do not permit one to extinguish Hanukkah candles under any circumstances.
In sum, though it is acceptable, according to the Shulchan Aruch and others, to extinguish Hanukkah candles after 30 minutes, the preferred course of action is to enjoy their light until they burn down on their own. If possible, light candles when you have enough time to wait for them to burn completely or, if you must go out, consider lighting the Hanukkah candles at your destination. Though they are ideally lit right after sunset, they can be lit later in the evening.