Mex is first mentioned in 1154 as Mais.
Mex has an area, as of 2009, of 2.83 square kilometers (1.09 sq mi). Of this area, 1.57 km2 (0.61 sq mi) or 55.5% is used for agricultural purposes, while 0.83 km2 (0.32 sq mi) or 29.3% is forested. Of the rest of the land, 0.48 km2 (0.19 sq mi) or 17.0% is settled (buildings or roads).
Of the built up area, industrial buildings made up 2.1% of the total area while housing and buildings made up 9.2% and transportation infrastructure made up 4.9%. Out of the forested land, 27.9% of the total land area is heavily forested and 1.4% is covered with orchards or small clusters of trees. Of the agricultural land, 44.9% is used for growing crops and 7.4% is pastures, while 3.2% is used for orchards or vine crops.
The municipality was part of the Cossonay District until it was dissolved on 31 August 2006, and Mex became part of the new district of Gros-de-Vaud.
It consists of the village of Mex as well as the Les Esserts housing development (which is separated from the village by the A1 motorway).
The blazon of the municipal coat of arms is Or, a Chevron Gules.
Mex has a population (as of December 2015) of 677. As of 2008, 21.2% of the population are resident foreign nationals. Over the last 10 years (1999–2009 ) the population has changed at a rate of 29.2%. It has changed at a rate of 20.2% due to migration and at a rate of 9.1% due to births and deaths.
Most of the population (as of 2000) speaks French (481 or 87.9%), with German being second most common (30 or 5.5%) and Italian being third (11 or 2.0%).
Of the population in the municipality 73 or about 13.3% were born in Mex and lived there in 2000. There were 266 or 48.6% who were born in the same canton, while 89 or 16.3% were born somewhere else in Switzerland, and 102 or 18.6% were born outside of Switzerland.
In 2008 there were 7 live births to Swiss citizens and 1 birth to non-Swiss citizens, and in same time span there were 2 deaths of Swiss citizens. Ignoring immigration and emigration, the population of Swiss citizens increased by 5 while the foreign population increased by 1. There was 1 Swiss man who emigrated from Switzerland and 1 Swiss woman who immigrated back to Switzerland. At the same time, there was 1 non-Swiss man who immigrated from another country to Switzerland and 1 non-Swiss woman who emigrated from Switzerland to another country. The total Swiss population remained the same in 2008 and the non-Swiss population increased by 10 people. This represents a population growth rate of 1.6%.
The age distribution, as of 2009, in Mex is; 72 children or 11.0% of the population are between 0 and 9 years old and 62 teenagers or 9.5% are between 10 and 19. Of the adult population, 85 people or 13.0% of the population are between 20 and 29 years old. 115 people or 17.6% are between 30 and 39, 87 people or 13.3% are between 40 and 49, and 104 people or 15.9% are between 50 and 59. The senior population distribution is 77 people or 11.8% of the population are between 60 and 69 years old, 35 people or 5.4% are between 70 and 79, there are 15 people or 2.3% who are between 80 and 89, and there are 2 people or 0.3% who are 90 and older.
As of 2000, there were 218 people who were single and never married in the municipality. There were 284 married individuals, 9 widows or widowers and 36 individuals who are divorced.
As of 2000, there were 240 private households in the municipality, and an average of 2.2 persons per household. There were 77 households that consist of only one person and 11 households with five or more people. Out of a total of 244 households that answered this question, 31.6% were households made up of just one person. Of the rest of the households, there are 78 married couples without children, 74 married couples with children There were 4 single parents with a child or children. There were 7 households that were made up of unrelated people and 4 households that were made up of some sort of institution or another collective housing.
In 2000 there were 92 single family homes (or 66.2% of the total) out of a total of 139 inhabited buildings. There were 24 multi-family buildings (17.3%), along with 16 multi-purpose buildings that were mostly used for housing (11.5%) and 7 other use buildings (commercial or industrial) that also had some housing (5.0%). Of the single family homes 21 were built before 1919, while 8 were built between 1990 and 2000. The greatest number of single family homes (25) were built between 1971 and 1980. The greatest number of multi-family homes (7) were built before 1919 and again between 1981 and 1990
In 2000 there were 240 apartments in the municipality. The most common apartment size was 3 rooms of which there were 72. There were 10 single room apartments and 96 apartments with five or more rooms. Of these apartments, a total of 207 apartments (86.3% of the total) were permanently occupied, while 30 apartments (12.5%) were seasonally occupied and 3 apartments (1.3%) were empty. As of 2009, the construction rate of new housing units was 3.1 new units per 1000 residents. The vacancy rate for the municipality, in 2010, was 1.97%.
The historical population is given in the following chart:
The D'En-Bas Castle is listed as a Swiss heritage site of national significance. The entire village of Mex is part of the Inventory of Swiss Heritage Sites.
In the 2007 federal election the most popular party was the SVP which received 40.96% of the vote. The next three most popular parties were the FDP (16.81%), the SP (11.58%) and the LPS Party (10.31%). In the federal election, a total of 195 votes were cast, and the voter turnout was 50.6%.
As of 2010, Mex had an unemployment rate of 3%. As of 2008, there were 9 people employed in the primary economic sector and about 5 businesses involved in this sector. 1,393 people were employed in the secondary sector and there were 5 businesses in this sector. 43 people were employed in the tertiary sector, with 10 businesses in this sector. There were 319 residents of the municipality who were employed in some capacity, of which females made up 46.1% of the workforce.
In 2008 the total number of full-time equivalent jobs was 1,408. The number of jobs in the primary sector was 8, all of which were in agriculture. The number of jobs in the secondary sector was 1,373 of which 1,367 or (99.6%) were in manufacturing and 6 (0.4%) were in construction. The number of jobs in the tertiary sector was 27. In the tertiary sector; 5 or 18.5% were in wholesale or retail sales or the repair of motor vehicles, 1 was in the movement and storage of goods, 5 or 18.5% were in a hotel or restaurant, 1 was in education.
In 2000, there were 745 workers who commuted into the municipality and 262 workers who commuted away. The municipality is a net importer of workers, with about 2.8 workers entering the municipality for every one leaving. Of the working population, 7.2% used public transportation to get to work, and 79.3% used a private car.
From the 2000 census, 140 or 25.6% were Roman Catholic, while 252 or 46.1% belonged to the Swiss Reformed Church. Of the rest of the population, there were 15 members of an Orthodox church (or about 2.74% of the population), and there were 54 individuals (or about 9.87% of the population) who belonged to another Christian church. There was 1 individual who was Islamic. There was 1 person who was Buddhist. 82 (or about 14.99% of the population) belonged to no church, are agnostic or atheist, and 28 individuals (or about 5.12% of the population) did not answer the question.
In Mex about 230 or (42.0%) of the population have completed non-mandatory upper secondary education, and 120 or (21.9%) have completed additional higher education (either university or a Fachhochschule). Of the 120 who completed tertiary schooling, 54.2% were Swiss men, 24.2% were Swiss women, 15.0% were non-Swiss men and 6.7% were non-Swiss women.
In the 2009/2010 school year there were a total of 58 students in the Mex (VD) school district. In the Vaud cantonal school system, two years of non-obligatory pre-school are provided by the political districts. During the school year, the political district provided pre-school care for a total of 296 children of which 96 children (32.4%) received subsidized pre-school care. The canton's primary school program requires students to attend for four years. There were 29 students in the municipal primary school program. The obligatory lower secondary school program lasts for six years and there were 29 students in those schools.
As of 2000, there were 3 students in Mex who came from another municipality, while 80 residents attended schools outside the municipality.