Gex (French: [ʒɛks]; Arpitan: Gèx; Italian: Gesio) is a commune in the Ain department in eastern France.
It lies 5 km (3.1 mi) from the Swiss border and 16 km (9.9 mi) from Geneva. It is a subprefecture of Ain.
The town gave its name to the Pays de Gex, at various times under the jurisdiction of France, Switzerland and the Duchy of Savoy.
With the 1815 Protocol of the Conference of Paris, (signed on 20 November) and the Treaty of Paris of the same date, Gex was placed in the Customs region of Switzerland and neutralised. The resolutions regarding the Pays de Gex were annulled by Art 435 of the Treaty of Versailles. In November 1923 France moved its customs office to Gex, and the matter was brought before the Permanent Court of International Justice (predecessor of the International Court of Justice), which decided in favour of Switzerland; this case is also notable for being an early example of the doctrine of fundamentally changed circumstances being invoked before an international court. A compromise was reached in 1932.
Historically, citizens spoke a dialect of the Franco-Provençal language but this dialect is not in use anymore.
Its principal market for exports is Geneva. A weekly market takes place in the town on Saturdays.