The nearest Brtish Rail station is Wareham which is 10 miles from Swanage. The regular bus service 40 travels from Wareham station to the centre of Swanage. Alternatively, you can catch the same bus from Poole railway station.
From Bournemouth there is also a regular bus service, the number 50 which travels from Bournemouth Railway station to the centre of Swanage.
You can view an up to date timetables on the morebus website.
If you are travelling by car to Swanage, then you may like to take advantage of the car park at Norden (just outside Corfe Castle) and travel into Swanage by steam train. Please check their website though for times, prices, etc.
Swanage is also served by National Express from Victoria Coach Station in London. Please note that only one coach comes each day arriving in the evening and leaving in the morning. Check the National Express website for more information.