Contra Costa County (Spanish for "opposite coast") is a primarily suburban county in the San Francisco Bay Area of the U.S. state of California. As of the 2006, the US Census Bureau estimated it had a population of 1,024,319. The county seat is Martinez.

According to the U.S. Census Bureau, the county has a total area of 802 square miles, of which, 720 square miles of it is land and 82 square miles of it (10.25%) is water.

It is bounded on the south and west by Alameda County; on the northwest San Francisco Bay (San Francisco and Marin Counties); on the North by San Pablo Bay, the Carquinez Strait, and Suisun Bay (Solano and Sacramento Counties); and on the east by the San Joaquin River (San Joaquin County).

There is an extensive but little recorded human pre-European invasion history in this area, with the present county containing portions of regions populated by a number of native American tribes. The earliest definitively established occupation by modern man appears to have occurred six to ten thousand years ago. However, there may have been human presence far earlier, at least as far as non–settling populations are concerned. The known settled populations were hunter-gatherer societies that had no knowledge of metals and that produced utilitarian crafts for everyday use (especially woven reed baskets) of the highest quality and with graphic embellishments of great aesthetic appeal. Extensive trading from tribe to tribe transferred exotic materials such as obsidian (useful for the making of arrowheads) throughout the region from far distant Californian tribes. Unlike the nomadic native American of the Great Plains it appears that these tribes did not incorporate warfare into their culture but were instead generally cooperative. Within these cultures the concept of individual or collective land ownership was nonexistent. Early European settlers in the region, however, did not record much about the culture of the natives. Most of what is known culturally comes from preserved contemporaneous and excavated artifacts and from inter-generational knowledge passed down through northerly outlying tribes of the larger region.

Early interaction of these Native Americans with Europeans came with the Spanish colonization via the establishment of missions in this area, with the missions in San Jose, Sonoma, and San Francisco and particularly the establishment of the Presidio of San Francisco (a military establishment) in 1776. Although there were no missions established within this county, Spanish influence here was direct and extensive, through the establishment of land grants from the King of Spain to favored settlers.

In 1821 Mexico gained independence from Spain. While little changed in ranchero life, the Mexican War of Independence resulted in the secularization of the missions with the re-distribution of their lands, and a new system of land grants under the Mexican Federal Law of 1824. Mission lands extended throughout the Bay Area, including portions of Contra Costa County.

Eighteen land grants were made in what became Contra Costa County. The smallest unit was one square league, or about seven square miles, or 4,400 acres, maximum to one individual was eleven leagues, or 48,400 acres, including no more than 4,428 acres of irrigable land. Rough surveying was based on a map, or diseno, measured by streams, shorelines, and/or horseman who marked it with rope and stakes. Lands outside Rancho grants were designated 'el sobrante,' as in surplus or excess, and considered common lands. The law required the construction of a house within a year. Fences were not required and were forbidden where they might interfere with roads or trails. Locally a large family required roughly 2000 head of cattle and two square leagues of land (fourteen square miles) to live comfortably. Foreign entrepreneurs came to the area in order to provide goods that Mexico couldn’t, and trading ships were taxed.

The same year, 1824, Rancho Cañada de los Vaqueros was granted to Francisco Alviso, Antonio Higuera, and Manuel Miranda (26,660 acres confirmed in 1889 to heirs of Robert Livermore).

From 1833-46, three Ranchos San Ramon Mexican land grants were established to Bartolome Pacheco (southern San Ramon Valley) and Mariano Castro (northern San Ramon Valley) (1833, two square leagues), Jose Maria Amador (1834, 1835, four leagues).

In 1834 Rancho Monte del Diablo (present day Concord, California) was confirmed with 17,921 acres to Don Salvio Pacheco (born July 15, 1793, died 1876). The Pacheco family settled at the Rancho in 1846 (between the Pacheco shipping port townsite and Clayton area, and including much of Lime Ridge). The boundary lines were designated with stone markers. Clayton was later located on sobrante lands just east of Ranch Monte del Diablo (Mount Diablo).

Then on July 31, 1834, Rancho Arroyo de Las Nueces y Bolbones aka Rancho San Miguel (present day Walnut Creek), was granted to Dona Juana Sanchez de Pacheco, in recognition of the service of Corporal Miguel Pacheco 37 years earlier (confirmed 1853, patented to heirs 1866; the grant was for two leagues, but drawn free hand on the diseno/map, and reading "two leagues, more or less" as indicated in the diseno, but actually including and confirmed for nearly four leagues or nearly 18,000 acres, but only 10,000 acres were ever shown as having once belonged to Dona Juana.

On October 13, 1835, Rancho Los Meganos was granted, situated in what is now the Brentwood area. 'Meganos' means 'sand dunes.' A "paraje que llaman los Méganos" 'place called the sand dunes' (with a variant spelling) is mentioned in Durán’s diary on May 24, 1817. Two Los Medanos Ranchos were granted, later differentiated as Los Meganos (1835, three leagues or at least 13,285 acres), to Jose Noriega then acquired by John Marsh and Los Medanos (to Jose Antonio Mesa and Jose Miguel Garcia, Pittsburg area, dated November 26, 1839).

The exclusive land ownership by Hispanics would soon end. This change began with the Bear Flag Revolt in 1846 when a few settlers from the United States declared a republic, and immediately petitioning for statehood. Following the Mexican-American War of 1847, California was annexed to the U.S. in 1848 and was admitted to the Union in 1850. The land titles in Contra Costa County may be traced to multiple subdivisions of a few original land grants. The grantee's family names live on in a few city and town names such as Martinez, Pacheco and Moraga and in the names of streets, residential subdivisions, and business parks. A few mansions from the more prosperous farms have been preserved as museums and cultural centers and one of the more rustic examples has been preserved as a working demonstration ranch, Borges Ranch.

Contra Costa County was one of the original counties of California, created in 1850 at the time of statehood. The county was originally to be called Mt. Diablo County, but the name was changed prior to incorporation as a county. The county's Spanish language name means opposite coast, because of its location opposite San Francisco, in an easterly direction, on San Francisco Bay. Southern portions of the county's territory, including the all of the bayside portions opposite San Francisco, and Northern portions of Santa Clara County were given up to form Alameda County effective March 25, 1853.

During World War II, Richmond hosted one of the two Bay Area sites of Kaiser Shipyards and wartime pilots were trained at what is now Concord/Buchanan Field Airport. Additionally, a large Naval Weapons Depot and munitions ship loading facilities at Port Chicago remain active to this day, but with the inland storage facilities recently declared surplus, extensive redevelopment is being planned for this last large central-county tract. The loading docks were the site of a devastating explosion in 1944. Port Chicago was bought out and demolished by the Federal Government to form a safety zone near the Naval Weapons Station loading docks. At one time the Atlas Powder Company (subsequently closed) at the town of Hercules produced gunpowder and dynamite. The site of the former Atlas Powder Company is located at Point Pinole Regional Shoreline, part of the East Bay Regional Parks District.

With the postwar baby boom and the desire for suburban living, large tract housing developers would purchase large central county farmsteads and develop them with roads, utilities and housing. Once mostly rural walnut orchards and cattle ranches, the area was first developed as low cost, large lot suburbs, with a typical low cost home being placed on a "quarter acre" lot — actually a little less at 10,000 square feet. Some of the expansion of these suburban areas was clearly attributable to white flight from decaying areas of Alameda County and the consolidated city-county of San Francisco, although in this politically liberal region, the phenomenon was mostly due to larger houses and lots at little additional cost, a desire for a less intensely urban environment, and higher school quality.