Codegua is a Chilean commune and city in Cachapoal Province, O'Higgins Region. According to the 2002 census, the commune population was 10,796 and has an area of 286.9 km².
According to the 2002 census of the National Statistics Institute, Codegua has 10,796 inhabitants (5,551 men and 5,245 women). Of these, 5,253 (48.7%) lived in urban areas and 5,543 (51.3%) in rural areas. The population fell by 12.5% (1,196 persons) between the 1992 and 2002 censuses.
As a commune, Codegua is a third-level administrative division of Chile administered by a municipal council, headed by an alcalde who is directly elected every four years. The 2008-2012 alcalde is Ana María Silva Gutierrez.
Within the electoral divisions of Chile, Codegua is represented in the Chamber of Deputies by Mr. Eugenio Bauer (UDI) and Mr. Ricardo Rincón (PDC) as part of the 33rd electoral district, (together with Mostazal, Graneros, Machalí, Requínoa, Rengo, Olivar, Doñihue, Coinco, Coltauco, Quinta de Tilcoco and Malloa). The commune is represented in the Senate by Andrés Chadwick Piñera (UDI) and Juan Pablo Letelier Morel (PS) as part of the 9th senatorial constituency (O'Higgins Region).