A monoid is a semigroup with an identity element: a set M with an associative binary operation ∗ and an element e such that e ∗ a = a ∗ e = a for all a ∈ M. Monoids capture the idea of composable operations with a do-nothing option.

The natural numbers under addition form a monoid (identity 0). The natural numbers under multiplication form another (identity 1). The set of endofunctions on any set forms a monoid under composition (identity is the identity function). Strings under concatenation form a monoid (identity is the empty string) — this is the free monoid on the alphabet.

A monoid is a category with exactly one object: the morphisms are the elements, composition is the monoid operation, and the identity morphism is the identity element. This perspective connects elementary algebra to category theory. A monoidal category generalizes the monoid concept to the categorical setting, equipping a category with a tensor product that acts like the binary operation and a unit object that acts like the identity.