We show that the minimal base size $b(G)$ of a finite primitive permutation group $G$ of degree $n$ is at most $2 (log |G|/log n) + 24$. This bound is asymptotically best possible since there exists a sequence of primitive permutation groups $G$ of degrees $n$ such that $b(G) = lfloor 2 (log |G|/log n) rceil - 2$ and $b(G)$ is unbounded. As a corollary we show that a primitive permutation group of degree $n$ that does not contain the alternating group $mathrm{Alt}(n)$ has a base of size at most $max{sqrt{n} , 25}$.