Topological spaces are structures that allow one to formalize concepts such as convergence, connectedness and continuity. They appear in virtually every branch of modern mathematics and are a central unifying notion. The branch of mathematics that studies topological spaces in their own right is called topology.
Definition
A topological space is a set X together with a collection T of subsets of X satisfying the following axioms:
 The empty set and X are in T.
 The union of any collection of sets in T is also in T.
 The intersection of any pair of sets in T is also in T.
The set T is a topology on X. The sets in T are the open sets, and their complements in X are the closed sets. The elements of X are called points.
The first axiom is redundant and just included for clarity. The union of an empty collections of sets is the empty set and therefore the empty set is in T. The intersection of an empty collection of sets is the complete set X and therefore X is in T too.
Note that the requirement that the union of any collection of sets is a member of the topology is more stringent than simply requiring that all pairwise unions must be members, as the former includes unions of infinite collections of sets.
Relations between topologies
A variety of useful and notsouseful topologies can be placed on nearly any set to form a topological space. When every set in a topology T_{1} is also found in a topology T_{2}, we say that T_{2} is finer than T_{1}, and T_{1} is coarser than T_{2}. A proof which relies only on the existence of certain open sets will also hold for any finer topology, and similarly a proof that relies only on certain sets not being open applies to any coarser topology. The terms larger and smaller are sometimes used in place of finer and coarser, respectively. The terms stronger and weaker are also used in the literature, but with little agreement on the meaning, so one should always be sure of an author's convention when reading.
Continuous functions
A function between topological spaces is said to be continuous if the inverse image of every open set is open. This is an attempt to capture the intuition that there are no "breaks" or "separations" in the function. A homeomorphism is a bijection that is continuous and whose inverse is also continuous. Two spaces are said to be homeomorphic if there exists a homeomorphism between them. From the standpoint of topology, homeomorphic spaces are essentially identical.
The category of topological spaces, Top, with topological spaces as objects and continuous functions as morphisms is one of the fundamental categories in mathematics. The attempt to classify the objects of this category by invariants has motivated and generated entire areas of research, such as homotopy theory, homology theory, and Ktheory, to name just a few.
Alternative definitions
There are many other equivalent ways to define a topological space. (In other words, each of the following defines a category equivalent to the category of topological spaces above.)
 Using de Morgan's laws, the axioms defining open sets become axioms defining closed sets:
 The empty set and X are closed.
 The intersection of any collection of closed sets is also closed.
 The union of any pair of closed sets is also closed.
 A neighbourhood of a point x is any set that contains an open set containing x. The neighbourhood system at x consists of all neighbourhoods of x. A topology can be determined by a set of axioms concerning all neighbourhood systems. Equivalently, a topology can be determined by a nearness relation between sets and points.
 A net is a generalisation of the concept of sequence. A topology is completely determined if for every net in X the set of its accumulation points is specified.
Examples of topological spaces
 The set of real numbers R is a topological space: the open sets are generated by the base of open intervals. This means a set is open if it is the union of (possibly infinitely many) open intervals. This is in many ways the most basic topological space and the one that guides most of our human intuition. However, relying on the real line as an intuitive guide for the general concept of topological space can often be dangerous.
 More generally, the Euclidean spaces R^{n} are topological spaces, and the open sets are generated by open balls.
 Any metric space turns into a topological space if one defines the open sets to be generated by the set of all open balls. This includes useful infinitedimensional spaces like Banach spaces and Hilbert spaces studied in functional analysis.
 Any local field has a topology native to it, and this can be extended to vector spaces over that field.
 The real line can also be given the lower limit topology. Here, the open sets consist of the empty set, the whole real line, and all sets generated by halfopen intervals of the form [a, b). This topology on R is strictly finer than the Euclidean topology defined above; a sequence converges to a point in this topology if and only if it converges from above in the Euclidean topology. This example shows that a set may have many distinct topologies defined on it.
 Every manifold is a topological space.
 Every simplex is a topological space. Simplexes are convex objects that are very useful in computational geometry. In 0, 1, 2 and 3 dimensional space the simplexes are the point, line segment, triangle and tetrahedron, respectively.
 Every simplicial complex is a topological space. A simplicial complex is made up of many simplices. Many geometric objects can be modeled by simplicial complexes — see also Polytope.
 The Zariski topology is a purely algebraically defined topology on the spectrum of a ring or an algebraic variety. On R^{n} or C^{n} the closed sets of the Zariski topology are the solution sets of systems of polynomial equations.
 A linear graph is a topological space that generalises many of the geometric aspects of graphs with vertices and edges.
 Many sets of operators in functional analysis are endowed with topologies that are defined by specifying when a particular sequence of functions converges to the zero function.
 Any set can be given the discrete topology in which every set is open. The only convergent sequences or nets in this topology are those that are eventually constant.
 Any set can be given the trivial topology in which only the empty set and the whole space are open. Every sequence and net in this topology converges to every point of the space. This example shows that in general topological spaces, limits of sequences need not be unique.
 Any infinite set can be given the cofinite topology in which the open sets are the empty set and the sets whose complement is finite. This is the smallest T_{1} topology on the set.
 If Γ is an ordinal number, then the set [0, Γ] is a topological space, generated by the intervals (a, b], where a and b are elements of Γ.
Topological constructions
 Every subset of a topological space can be given the subspace topology in which the open sets are the intersections of the open sets of the larger space with the subset.
 For any nonempty collection of topological spaces, the product can be given the product topology. For finite products, the open sets are generated by the products of open sets.
 A quotient space is defined as follows. If X is a topological space and Y is a set, and if f : X → Y is a surjective function, then Y gets a topology where a set is open if and only if its inverse image is open. A common example comes from an equivalence relation defined on the topological space X: the map f is then the natural projection onto the set of equivalence classes.
 The Vietoris topology on the set of all nonempty subsets of a topological space X is generated by the following basis: for every ntuple U_{1}, ..., U_{n} of open sets in X, we construct a basis set consisting of all subsets of the union of the U_{i} which have nonempty intersection with each U_{i}.
Classification of topological spaces
Topological spaces can be broadly classified according to their degree of connectedness, their size, their degree of compactness and the degree of separation of their points and subsets. A great many terms are used in topology to achieve these distinctions. These terms and definitions are collected together in the topology glossary. Using these terms, we can give the following classification:
Separation of points
For a detailed treatment, see Separation axiom. Some of these terms are defined differently in older mathematical literature; see History of the separation axioms.

T_{0} or Kolmogorov. A space is T_{0} if for every pair of distinct points x and y in the space, either there is an open set containing x but not y, or there is an open set containing y but not x.

T_{1} or Fréchet. A space is T_{1} if for every pair of distinct points x and y in the space, there is an open set containing x but not y. (Compare with T_{0}; here, we are allowed to specify which point will be contained in the open set.) Equivalently, a space is T_{1} if all its singletons are closed. T_{1} spaces are always T_{0}.

T_{2} or Hausdorff. A space is Hausdorff if every two distinct points have disjoint neighbourhoods. Hausdorff spaces are always T_{1}.

Regular. A space is regular if whenever C is a closed set and p is a point not in C, then C and p have disjoint neighbourhoods.
 T_{3} or Regular Hausdorff. A space is regular Hausdorff if it is a regular T_{0} space. (A regular space is Hausdorff if and only if it is T_{0}, so the terminology is consistent.)

Completely regular. A space is completely regular if whenever C is a closed set and p is a point not in C, then C and {p} are functionally separated.

T_{3½}, Tychonoff, Completely regular Hausdorff or Completely T_{3}. A Tychonoff space is a completely regular T_{0} space. (A completely regular space is Hausdorff if and only if it is T_{0}, so the terminology is consistent.) Tychonoff spaces are always regular Hausdorff.

Normal. A space is normal if any two disjoint closed sets have disjoint neighbourhoods. Normal spaces admit partitions of unity.
 T_{4} or Normal Hausdorff. A normal space is Hausdorff if and only if it is T_{1}. Normal Hausdorff spaces are always Tychonoff.
 Completely normal. A space is completely normal if any two separated sets have disjoint neighbourhoods.
 T_{5} or Completely normal Hausdorff. A completely normal space is Hausdorff if and only if it is T_{1}. Completely normal Hausdorff spaces are always normal Hausdorff.

Discrete space. A space is discrete if all of its points are completely isolated, i.e. if any subset is open.
Countability conditions
Connectedness

Connected. A space X is connected if it is not the union of a pair of disjoint nonempty open sets. Equivalently, a space is connected if the only clopen sets are the whole space and the empty set.

Locally connected. A space is locally connected if every point has a local base consisting of connected sets.
 Totally disconnected. A space is totally disconnected if it has no connected subset with more than one point.

Pathconnected. A space X is pathconnected if for every two points x, y in X, there is a path p from x to y, i.e., a continuous map p: [0,1] → X with p(0) = x and p(1) = y. Pathconnected spaces are always connected.

Locally pathconnected. A space is locally pathconnected if every point has a local base consisting of pathconnected sets. A locally pathconnected space is connected if and only if it is pathconnected.

Simply connected. A space X is simply connected if it is pathconnected and every continuous map f: S^{1} → X is homotopic to a constant map.

Contractible. A space X is contractible if the identity map on X is homotopic to a constant map. Contractible spaces are always simply connected.
 Hyperconnected. A space is hyperconnected if no two nonempty open sets are disjoint. Every hyperconnected space is connected.
 Ultraconnected. A space is ultraconnected if no two nonempty closed sets are disjoint. Every ultraconnected space is pathconnected.

Indiscrete or Trivial. A space is indiscrete if the only open sets are the whole space and the empty set. Such a space is said to have the trivial topology.
Compactness

Compact. A space is compact if every open cover has a finite subcover. Compact spaces are always Lindelöf and paracompact. Compact Hausdorff spaces are therefore normal.

Paracompact. A space is paracompact if every open cover has an open locally finite refinement. Paracompact Hausdorff spaces are normal.
 Countably compact. A space is countably compact if every countable open cover has a finite subcover.

Locally compact. A space is locally compact if every point has a local base consisting of compact neighbourhoods. Locally compact Hausdorff spaces are always Tychonoff.
 Ultraconnected compact. In an ultraconnected compact space X every open cover must contain X itself. Nonempty ultraconnected compact spaces have a largest proper open subset called a monolith.
Metrizability

Metrizable. A space is metrizable if it is homeomorphic to a metric space. Metrizable spaces are always Hausdorff and paracompact (and hence normal and Tychonoff), and firstcountable.
 Polish. A space is called Polish if it is metrizable with a separable and complete metric.
 Locally metrizable. A space is locally metrizable if every point has a metrizable neighbourhood.
Miscellaneous

Baire space. A space X is a Baire space if it is not meagre in itself. Equivalently, X is a Baire space if the intersection of countably many dense open sets is dense.

Homogeneous. A space X is homogeneous if for every x and y in X there is a homeomorphism f : X > X such that f(x) = y. Intuitively speaking, this means that the space looks the same at every point. All topological groups are homogeneous.

Finitely generated or Alexandrov. A space X is Alexandrov if arbitrary intersections of open sets in X are open. Equivalently if arbitrary unions of closed sets are closed. These are precisely the finitely generated members of the category of topological spaces and continuous maps.

Zerodimensional. A space is zerodimensional if it has a base of clopen sets. These are precisely the spaces with a topological dimension of 0.
 Almost discrete. A space is almost discrete if every open set is closed (hence clopen). The almost discrete spaces are precisely the finitely generated zerodimensional spaces.

Boolean. A space is Boolean if it is zerodimensional, compact and Hausdorff (equivalently, totally disconnected, compact and Hausdorff). These are precisely the spaces that are homeomorphic to the Stone spaces of Boolean algebras.
Topological spaces with algebraic structure
For any algebraic objects we can introduce the discrete topology, under which the algebraic operations are continuous functions. For any such structure which is not finite, we often have a natural topology which is compatible with the algebraic operations in the sense that the algebraic operations are still continuous. This leads to concepts such as topological groups, topological vector spaces, topological rings and local fields.
Topological spaces with order structure
History
See topology.