While the bus is a more popular way to get around in Estonia, the country does have a system of passenger trains as well. Tallinn's Baalti jaam (main train station) is located on Toompuiestee 37, a 10-minute walk northwest of the Old Town. Trams 1 and 2 also stop just outside the station. The primary connections at the station are the GoRail daily train from Tallinn to St. Petersburg, Russia, and overnight train to Moscow. (NOTE: be sure you have an appropriate visa for Russia before setting out) In addition, Estonian Rail company Edelaraudtee provides local service to Tartu, Narva, Valga, Pechory, Pärnu, and Viljandi.
International train connections (other than to/from Russia) are difficult and slow, but possible (and cheap). As of 2013, one train per day to Valga connects with a Latvian train to Riga. Travel time is roughly 8 hours, but cost is just under EUR 14. It should be noted that there is an EU project underway to complete a EuroCity rail link from Tallin to Warsaw via Riga and Kaunas, Lithuania. Estimated completion date is 2020.
Tallinn's Balti Jaam (Baltic Station) is not very busy. It runs a few trains to nearby cities, like Tartu, and a very limited schedule to international cities. There are trains to Moscow and St. Petersburg, but no direct trains to even the neighbouring Baltic countries. If you want to go to Riga you must change trains, or take a bus.
The train station itself is easy to find, just leave the old city through the east gate and cross Toom park. It's on the other side of the busy road behind the Go Hotel, casino and related buildings.
The train (except regional commuter trains) seems to have become an exotic means to travel to Talllinn but the view of the old city from the Raudteejaam (Balti jaam) is quite spectacular too. But most overland travellers to Tallinn come by bus or own car.
The "long" distance traffic to a few Estonian places is run by "Edelraud" railway company. But if you read at their website the following."In addition to our considerable experience of operating on Estonian railways, we are pleased to state that the railway company GB Railways, Great Britain became our experienced partner through privatisation in 2000. Relying on their know-how, we can claim that in the future..." it sounds like a warning (for those who enjoyed rail travel in the UK)..
I have to confess that I never used trains in or to Estonia but travelled by all other means and all was good so it seems not necessary to use the apparently strange and few remaning Estonian train services.
Not to forget - there is a last remaining international train service - the one to Russia.
On the northwest side of the Old Town you will find the Central Train Station (Balti Jaam). Trains depart here to any direction in Estonia.
There are 3 tickets area in the building:
the main hall (travel around Estonia)
upstairs (international tickets)
separate 'elektriraudtee' ticket office, next to the train platforms (electric trains within the Tallin area)
The Central Station (Balti Jaam) of Tallinn is located just northwest of the Old Town. Domestic trains serve Tartu, Parnu, Viljandi, Valga, Narva and Paldiski.
There are both a daily international train to Moscow and to St. Petersburg (EVR EKSPRESS).
Unfortunately there is no longer a direct train connection between Tallinn and Riga, because buses are much faster. To get to Riga by train you have to change at Valga.