The mayor of the City and County of San Francisco is the head of the executive branch of the San Francisco city and county government. The officeholder has the duty to enforce city laws, and the power to either approve or veto bills passed by the San Francisco Board of Supervisors, the legislative branch. The mayor serves a four-year term and is limited to two successive terms. Because of San Francisco's status as a consolidated city-county, the mayor also serves as the head of government of the county; both entities have been governed together by a combined set of governing bodies since 1856.
 There have been 45 individuals who have served as mayor in San Francisco since 1850, when California became a state following the American Conquest of California. Prior to the conquest, Californios served as Mayor of San Francisco during the Spanish and Mexican eras since 1779.
 The current mayor is former District 5 supervisor and president of the Board of Supervisors London Breed, who won a special election following the death of Mayor Ed Lee on December 12, 2017.  Breed served out the remainder of Lee's uncompleted term (until January 8, 2020), after which she is eligible to run for two full terms of her own including the 2019 San Francisco mayoral election which she won.
 The mayor of San Francisco is elected every four years; elections take place one year before United States presidential elections on election day in November. Candidates must live and be registered to vote in San Francisco at the time of the election. The mayor is usually sworn in on the January 8 following the election. The next election for a full mayoral term will be in 2023.
 Under the California constitution, all city elections in the state are conducted on a non-partisan basis. As a result, candidates' party affiliations are not listed on the ballot, and multiple candidates from a single party can run in the election.
 Mayoral elections were originally run under a two-round system. If no candidate received a simple majority of votes in the general election, the two candidates who received the most votes competed in a second runoff election held several weeks later. In 2002, the election system for city officials was overhauled as a result of a citywide referendum. The new system, known as instant-runoff voting, allows voters to select and rank three candidates based on their preferences. If no one wins more than half of the first-choice votes, the candidate with the fewest votes is eliminated and second-choice votes (and third-choice votes, if necessary) are counted until a candidate captures the majority. This eliminates the need to hold a separate runoff election and saves money. This was first implemented in the 2004 Board of Supervisors election after two years of preparation. In 2007, the new system was implemented in the mayoral election for the first time.
 In 2022, San Francisco voters passed Proposition H which changed the mayoral elections to the same cycle as presidential elections. This gives London Breed an additional year to her first full term. This change was proposed because of the low turnout of off-year elections. For example, 2019 saw a turnout of only 42%, while 2020 saw 86% turnout.
 As of 2017, the mayor is paid an annual salary of $342,974, the highest mayoral salary in the United States. Nine city public employees earned higher salaries than the mayor, including the chief investment officer and the managing director of the San Francisco Employees' Retirement System, who oversee the city's pension plan.
 Unlike a few other American cities, the San Francisco mayor does not have an official residence; in the 1990s, Mayor Willie Brown unsuccessfully pushed to acquire the Yerba Buena Island mansion formerly used by U.S. Navy admirals as a ceremonial residence for the mayor.
 The mayor has the responsibility to enforce all city laws, administer and coordinate city departments and intergovernmental activities, set forth policies and agendas to the Board of Supervisors, and prepare and submit the city budget at the end of each fiscal year. The mayor has the powers to either approve or veto bills passed by the San Francisco Board of Supervisors, participate in meetings of the Board of Supervisors and its committees, appoint a replacement to fill vacancies in all city elected offices until elections, appoint a member of the Board to serve as acting mayor in the absence of the mayor, and to direct personnel in the case of emergency.
 When mayors die in office, resign, or are unable to carry out their duties, and did not designate an acting mayor, the president of the Board of Supervisors becomes acting mayor until the full Board selects a person to fill the vacancy and finish the previous mayoral term. (In the case that both the president of the Board of Supervisors and the mayor are incapacitated, the order of succession is followed.) This has happened seven times: James Otis died in office and was succeeded by George Hewston, Eugene Schmitz was removed and succeeded by Charles Boxton, Charles Boxton resigned and was succeeded by Edward Robeson Taylor, James Rolph resigned and was succeeded by Angelo Rossi, George Moscone was assassinated and was succeeded by Dianne Feinstein, Gavin Newsom resigned and was succeeded by Ed Lee, and Lee died in office and was succeeded by London Breed before the San Francisco Board of Supervisors selected Mark Farrell as interim mayor.
 To date, 44 individuals have served as San Francisco mayor. There have been 45 mayoralties due to Charles James Brenham's serving two non-consecutive terms: he is counted chronologically as both the second and fourth mayor. The longest term was that of James Rolph, who served over 18 years until his resignation to become the California governor. The length of his tenure as mayor was largely due to his popularity. During his term, San Francisco saw the expansion of its transit system, the construction of the Civic Center and the hosting of the World's Fair. The shortest term was that of Charles Boxton, who served only eight days before resigning from office. Three mayors have died in office: Otis died from illness, Moscone was assassinated in 1978, and Lee died from cardiac arrest. Dianne Feinstein and London Breed are the only women who have served as mayor, both of them by succession and by election; Willie Brown and London Breed are the only African Americans to serve to date; Ed Lee is the only Asian American to serve as mayor. Three mayors have Jewish ancestry: Washington Bartlett (Sephardi), Adolph Sutro (Ashkenazi), and Dianne Feinstein (Ashkenazi). Thirteen mayors are native San Franciscans: Levi Richard Ellert, James D. Phelan, Eugene Schmitz, James Rolph, Elmer Robinson, John F. Shelley, Joseph Alioto, George Moscone, Dianne Feinstein, Frank Jordan, Gavin Newsom, Mark Farrell, and London Breed. Four mayors are foreign-born: Frank McCoppin and P.H. McCarthy (United Kingdom of Great Britain and Ireland, both born in what is now the Republic of Ireland), Adolph Sutro (Prussia, part of Germany since 1871) and George Christopher (Greece).
 This list does not include acting mayors who are typically appointed whenever the mayor will be out of the city.