Most laws related to riding a bicycle are made at the state level. See our Guide to Laws for Cyclists in California.
Am I allowed to bike on the sidewalk?
In San Francisco, it’s illegal to ride on the sidewalk if you are over the age of 13.1SF Transportation Code Sec. 7.2.12
Pedestrians in SF
Streets & Public Spaces