The City of San Francisco is about 15 miles. I would recommend planning at least half an hour to get to/from the airport, however, you also have to keep traffic in mind in your planning. Allow extra time if you plan to take BART. Once you're in the city, you will be able to rely on Muni.
BART: $5.35/per person (to Powell Street if you're staying around Union Square, Embarcadero if going to Fisherman's Wharf... if going to FW, note you will have to either take a bus or taxi the rest of the way to your hotel from the Embarcadero station. Cost is a bit more coming from OAK and you'll have to use a shuttle to take you to BART.) The website also has a trip planner to help you.
Shuttle: $15/per person. ($25/pp from OAK)
Town Car: $55+ (try ExecuCar or ABC Transportation.)
For BART info, visit http://www.bart.gov/
Shuttle Services: http://www.supershuttle.com/ and http://www.lorries-shuttles.com/