Budapest is served by three main train stations: Keleti, Nyugati, and Deli. Each serves train travel in different directions and each is easily accessible by Budapest's Metro system.

Budapest is well connected by several international trains seving destinations all over Europe, including daily trains to Istanbul, Moscow and Berlin to name but a few. Train travel is comfortable and efficient and easy to arrange.
Budapest is also covered by Eurail passes which makes it very convenient for pass holders to travel around Europe for a set price.
Click here for Rail EuropeThe national Hungarian train company is called MAV and the MAV office on Andrassy Ut in downtown Budapest can sell tickets and provide information as can all three of the train stations.
One side-note: If you're planning to travel further east to various countries in the Balkans and the former Eastern Bloc countries, there is usually a substantial discount on return tickets. For example, a train to Kiev, Ukraine costs 12,000 HUF one-way, as well as return, thanks to a 50% discount!
Eurail Passes cover Hungary and are a great way to see the rest of Europe as well. If you're going to do much train traveling, a Eurail (Eurorail) pass is strongly recommended! You can find discount Eurail passes here at Rail Europe: Click here for Rail Europe