  For an $n$-dimensional Leibniz/Lie algebra $\mathfrak{h}$ over a field $k$ we
introduce a new invariant ${\mathcal A}(\mathfrak{h})$, called the
\emph{universal algebra} of $\mathfrak{h}$, as a quotient of the polynomial
algebra $k[X_{ij} \, | \, i, j = 1, \cdots, n]$ through an ideal generated by
$n^3$ polynomials. We prove that ${\mathcal A}(\mathfrak{h})$ admits a unique
bialgebra structure which makes it an initial object among all commutative
bialgebras coacting on $\mathfrak{h}$. The new object ${\mathcal A}
(\mathfrak{h})$ is the key tool in answering two open problems in Lie algebra
theory. First, we prove that the automorphism group ${\rm Aut}_{Lbz}
(\mathfrak{h})$ of $\mathfrak{h}$ is isomorphic to the group $U \bigl(
G({\mathcal A} (\mathfrak{h})^{\rm o} ) \bigl)$ of all invertible group-like
elements of the finite dual ${\mathcal A} (\mathfrak{h})^{\rm o}$. Secondly,
for an abelian group $G$, we show that there exists a bijection between the set
of all $G$-gradings on $\mathfrak{h}$ and the set of all bialgebra
homomorphisms ${\mathcal A} (\mathfrak{h}) \to k[G]$. Based on this, all
$G$-gradings on $\mathfrak{h}$ are explicitly classified and parameterized.
${\mathcal A} (\mathfrak{h})$ is also used to prove that there exists a
universal commutative Hopf algebra associated to any finite dimensional Leibniz
algebra $\mathfrak{h}$.
