We formulate gauge theories based on Leibniz(-Loday) algebras and uncover their underlying mathematical structure. Various special cases have been developed in the context of gauged supergravity and exceptional field theory. These are based on 'tensor hierarchies', which describe towers of p-form gauge fields transforming under non-abelian gauge symmetries and which have been constructed up to low levels. Here we define 'infinity-enhanced Leibniz algebras' that guarantee the existence of consistent tensor hierarchies to arbitrary level. We contrast these algebras with strongly homotopy Lie algebras (L ∞ algebras), which can be used to define topological field theories for which all curvatures vanish. Any infinity-enhanced Leibniz algebra carries an associated L ∞ algebra, which we discuss.