A magma is a set M equipped with a binary operation ∗: M × M → M. No axioms are imposed on the operation — it need not be associative, commutative, or have an identity element. A magma is the most general algebraic structure with a single binary operation.

The algebraic hierarchy builds from magmas by adding axioms. A magma whose operation is associative is a semigroup. A semigroup with an identity element is a monoid. A monoid where every element has an inverse is a group. Each step constrains the operation further, and many theorems depend on exactly which axioms are assumed.

Magmas are rarely studied in isolation, but they serve as the starting point for universal algebra — the study of algebraic structures defined by operations and equations. Every algebraic structure (group, ring, lattice) is a magma with additional axioms, and a homomorphism between algebraic structures is a function that preserves whatever operations and axioms are present.