Dunfermline is well-connected by rail. The Fife Circle line links it directly to Edinburgh (around 30 minutes to Edinburgh Waverley) and to other Fife towns including Kirkcaldy, Glenrothes, and St Andrews. Dunfermline has two stations: Dunfermline Town, which is closest to the city centre and the main historic sites, and Dunfermline Queen Margaret, which is slightly further out. Trains run frequently throughout the day.
By road, Dunfermline is accessed from the south via the Queensferry Crossing or the Kincardine Bridge. From Edinburgh, the Queensferry Crossing takes you directly to the M90, which connects to Dunfermline within a few minutes. Glasgow is around an hour by road, via the M90 and M8. The A985 runs east along the Forth coast to Kincardine and beyond.
There is no airport at Dunfermline; Edinburgh Airport is around 25 minutes by car.