In mathematics, the **cylinder sets** form a basis of the product topology on a product of sets; they are also a generating family of the cylinder σ-algebra.

Given a collection of sets, consider the Cartesian product of all sets in the collection. The **canonical projection** corresponding to some is the function that maps every element of the product to its component. A cylinder set is a preimage of a canonical projection or finite intersection of such preimages. Explicitly, it is a set of the form,
for any choice of , finite sequence of sets and subsets for .

Then, when all sets in are topological spaces, the product topology is generated by cylinder sets corresponding to the components' open sets. That is cylinders of the form where for each , is open in . In the same manner, in case of measurable spaces, the cylinder σ-algebra is the one which is generated by cylinder sets corresponding to the components' measurable sets.

The restriction that the cylinder set be the intersection of a *finite* number of open cylinders is important; allowing infinite intersections generally results in a finer topology. In the latter case, the resulting topology is the box topology; cylinder sets are never Hilbert cubes.

Let be a finite set, containing *n* objects or **letters**. The collection of all bi-infinite strings in these letters is denoted by

The natural topology on is the discrete topology. Basic open sets in the discrete topology consist of individual letters; thus, the open cylinders of the product topology on are

The intersections of a finite number of open cylinders are the **cylinder sets**

Cylinder sets are clopen sets. As elements of the topology, cylinder sets are by definition open sets. The complement of an open set is a closed set, but the complement of a cylinder set is a union of cylinders, and so cylinder sets are also closed, and are thus clopen.

Given a finite or infinite-dimensional vector space over a field *K* (such as the real or complex numbers), the cylinder sets may be defined as
where is a Borel set in , and each is a linear functional on ; that is, , the algebraic dual space to . When dealing with topological vector spaces, the definition is made instead for elements , the continuous dual space. That is, the functionals are taken to be continuous linear functionals.

Cylinder sets are often used to define a topology on sets that are subsets of and occur frequently in the study of symbolic dynamics; see, for example, subshift of finite type. Cylinder sets are often used to define a measure, using the Kolmogorov extension theorem; for example, the measure of a cylinder set of length *m* might be given by 1/*m* or by 1/2^{m}.

Cylinder sets may be used to define a metric on the space: for example, one says that two strings are **ε-close** if a fraction 1−ε of the letters in the strings match.

Since strings in can be considered to be *p*-adic numbers, some of the theory of *p*-adic numbers can be applied to cylinder sets, and in particular, the definition of *p*-adic measures and *p*-adic metrics apply to cylinder sets. These types of measure spaces appear in the theory of dynamical systems and are called nonsingular odometers. A generalization of these systems is the Markov odometer.

Cylinder sets over topological vector spaces are the core ingredient in the^{[citation needed]} definition of abstract Wiener spaces, which provide the formal definition of the Feynman path integral or functional integral of quantum field theory, and the partition function of statistical mechanics.