The **cofinite topology** on any set `X` makes `X` into a topological space such that the only closed subsets are finite sets, or the whole of `X`. Then `X` is automatically compact in this topology, since every open set only omits finitely many points of `X`. Put another way, the open sets in this topology are the cofinite sets, plus the empty set.

One place where this concept occurs naturally is in the context of the Zariski topology. Since polynomials over a field `K` are zero on finite sets, or the whole of `K`, the Zariski topology on `K` (considered as *affine line*) is the cofinite topology. The same is true for any *irreducible* algebraic curve; it is not true, for example, for *XY* = 0 in the plane.