Buses from Istanbul take about 6 hours and cost 20-25 YTL. Buses from Ankara take around 4 hours.
The nearest train station is in Karabuk, 10-15 km away. There are a daily train from Zonguldak and Ankara to Karabuk.
Dolmuses regularly drive the 2 km between the old town (Çarşı) and the new town center, which is where buses are likely to let you off / pick you up. Once in the old town, everything is reachable by foot. Additionally, some intercity buses might drop you off in the nearby steel down of Karabük. From there you'll have to find a dolmus into Safranbolu.
Take a look (and a tea?) inside the Cinci Hanı, a massive hotel in the center of the old town. Wandering around the city you will take in much, but to see inside the houses, head to one of the historic homes open to the public. Kaymakamlar Müze Evi is located just above Bastoncu Pansiyon, to the south-east of Cinci Hanı. Keep walking up the hill, and take in some beautiful views.
Bastoncu Pansiyon & Kafeterya, ☎ (90370) 712 3411 (Cell (0535) 642 1275.). One of the cheapest options in Safranbolu. It is clean and homely, with excellent meals. The owner speaks Japanese and English, and can help you plan your onward trip. Call them for a free pickup from the bus station. 20 YTL per person for dormitory, rooms are 50 YTL without bathroom, 60 YTL with. (Breakfast is included.).
Baglar Saray Otel Has a capacity of 42 rooms and 120 beds. 39 of the rooms have standard quality and 3 of them is suite. Huge bathrooms with full time hot water and a hair drier, a minibar, a phone that is open to the abroad and a television. Safranbolu Baglar Saray Otel shows historical marks and at the same time and it has an unlimited modern service understanding.