Fog is a common weather phenomenon in the San Francisco Bay Area as well as along the entire coastline of California extending south to the northwest coast of the Baja California Peninsula. The frequency of fog and low-lying stratus clouds is due to a combination of factors particular to the region that are especially prevalent in the summer. Another type of fog, tule fog, can occur during the winter. There are occasions when both types can occur simultaneously in the Bay Area.
The Pacific Ocean contributes to the frequency of fog by providing atmospheric moisture and by its temperature. It is also the major source of nuclei for the condensation of moisture from vapor into cloud droplets. Moisture evaporated from the ocean surface over hundreds, even thousands of miles of the open Pacific is carried to California from various directions. This water vapor contributes to the development of what is called a marine layer near the surface of the ocean.
Along the California coast, the prevailing current flows from the northwest and is cool owing to its origin in the North Pacific. Additional cooling occurs due to strong upwelling of cooler subsurface waters, especially along the immediate coastline and near various promontories. Sea surface temperatures along the coast are generally 52-58 °F (11-14 °C) year-round.
When the marine layer encounters the colder waters along the California coast, it cools to its dewpoint, and if small particles called condensation nuclei are present, liquid water drops will form. Condensation nuclei in coastal fog are mostly composed of salt from surf and spray, with lesser amounts of iodine from kelp. These nuclei are so effective that condensation can occur even before the dewpoint is reached.
The prevailing wind along the California coast is from the northwest owing to the normal location of the North Pacific High, a large area of high atmospheric pressure. As the coastline is oriented from northwest to southeast, the marine layer and any clouds present within it would be confined to the coast and adjacent offshore waters, and often are, but for the large difference in temperature between the coastal waters and the inland valleys, especially the Central Valley. In the summer, inland temperatures can soar as high as 100 °F (38 °C), and often higher. This large difference creates a strong pressure gradient that turns the prevailing northwest flow to a westerly and even southwesterly direction near the coastline, driving the marine layer and its clouds onshore and through any gaps in the Coast Ranges.
The largest coastal gap is the Golden Gate at the entrance to San Francisco Bay which also communicates via the Bay with the Carquinez Strait and the Central Valley. As the city of San Francisco lies adjacent to the Golden Gate, it is often subject to the fog and low clouds blowing in on the marine layer. Even when the clouds are not present, the coolness of the marine layer exacerbated by the strong winds can chill the city even in mid-summer. Because of this, San Francisco is sometimes referred to as "naturally air conditioned".
Under normal summertime conditions, a daily pattern of fog and low clouds occurs. Morning sun heats the ground which in turn heats the marine layer over the land areas. This creates convective turbulence within the marine layer as well as evaporation of any clouds within it. The marine layer clears back toward the coast, usually by noon. By mid-afternoon, inland areas have heated sufficiently to decrease the air pressure and increase the onshore flow. By late afternoon, the wind increases and begins to cool the onshore marine layer, allowing the fog and low clouds offshore to progress inland without evaporating. Cloudiness streams in over the Bay and through the various gaps. How far the clouds can penetrate inland depends on the depth of the marine layer and the strength of the cooling winds. As night falls and inland areas cool down, the winds usually decrease, but the fog and clouds remain wherever they have blown in until the following morning when the cycle repeats.
A land-sea temperature-pressure gradient is not always necessary to drive the marine layer and low clouds onshore into the Bay Area. Winds ahead of an approaching cold front or low pressure system can also push the marine layer onshore.
Another pattern variation occurs in connection with heat spells that reach the coast from inland. Such heat waves typically occur when an area of high atmospheric pressure orients itself in such a way that the northerly to northeasterly gradient becomes dominant, driving the marine layer out to sea south and west of the California coast. These spells typically end with what is called a "southerly surge", when the northerly gradient relaxes, allowing the marine layer to "slosh back" up the coastline.
Yet another variation occurs when the upper air becomes turbulent. Turbulence above the marine layer inversion can, depending on its severity, break up the marine layer. The most common causes of such turbulence are strong upper level low pressure areas, or the monsoon which occasionally extends northwestward from the desert areas of the U.S.
There are also occasional extended spells when fog and stratus ("overcast") do not clear all the way back to the coast for several days. These extended periods of cloudiness are usually a consequence of a weak area of low pressure above the marine layer which increases its depth, making it more difficult for surface heating to evaporate the clouds within it.
Research published in 2010 showed that summertime fog in California decreased by 33% during the 20th century. The decline in fog is generally attributed to global warming, and is concerning for the local ecology, for example the redwood trees. The attribution of the reduction in fog and of global warming itself to the Pacific Decadal Oscillation is generally rejected.
Writers, poets, and photographers have long been inspired by the fog, including Herb Caen, August Kleinzahler, and Arthur Ollman.Sam Green made a film about San Francisco's fog for the Exploratorium, which premiered in 2013. In Kyle Boelte's 2015 book The Beautiful Unseen: Variations on Fog and Forgetting, San Francisco's fog becomes a metaphor for grief and the limitations of memory.