  The present paper is devoted to the description of local and $2$-local
derivations on Cayley algebras over an arbitrary field $\mathbb{F}$. Given a
Cayley algebra $\mathcal{C}$ with norm $\mathfrak{n}$, let $\mathcal{C}_0$ be
its subspace of trace $0$ elements. We prove that the space of all local
derivations of $\mathcal{C}$ coincides with the Lie algebra $\{d\in
(\mathcal{C},\mathfrak{n}) | d(1)=0\}$ which is isomorphic to the orthogonal
Lie algebra $(\mathcal{C}_0,\mathfrak{n})$. Further we prove that,
surprisingly, the behavior of $2$-local derivations depends on the Cayley
algebra being split or division. Every $2$-local derivation on the split Cayley
algebra is a derivation, i.e. they form the exceptional Lie algebra
$\mathfrak{g}_2(\mathbb{F})$ if $\textrm{char}\mathbb{F}\neq 2,3$.
  On the other hand, on division Cayley algebras over a field $\mathbb{F}$, the
sets of $2$-local derivations and local derivations coincide, and they are
isomorphic to the Lie algebra $(\mathcal{C}_0,\mathfrak{n})$. As a corollary we
obtain descriptions of local and $2$-local derivations of the seven dimensional
simple non-Lie Malcev algebras over fields of characteristic $\neq 2,3$.
