Unless there has been a recent change, for tourists from most countries a 30 day stamp is available on arrival and is free.
There are many other visas available for longer term stays, but these usually have to be obtained (before travel) in the country you are travelling from. (If entering from the U.S.A. or one of 42 other countries you can be allowed to stay for up to 30 days without a visa - you'll get a stamp on your passport to this effect)
Check the Immigration Bureau website for requirements. Click here, then use the pull-down to find your country of origin. The visa requirements will pop up.
There are about 40 countries whose citizens will receive a "VOA" - visa on arrival. Actually it isn't really a visa, it just means you can stay in the country for 30 days without applying for a visa prior to arrival.
The rules concerning this have been altered slightly from Oct 2006. In the future you will not be allowed to do more than 90days (3 thirty day periods or 2 "visa runs"). After 90 days you will be required to get a visa before arrival and not allowed back in on a VOA for 6 months. There is a lot of confusion about this at the moment so check it out with Thai Immigration.
If you are planning to stay in Thailand or even the region for a longer period, it is advisable to contact your local consulate and find out what is available. It might cost but in the end you'll save on unwanted trips to other countries and borders.


