  Let $C\subset{\mathbb P}_K^2$ be an algebraic curve over a number field $K$,
and denote by $d_K$ the degree of $K$ over ${\mathbb Q}$. We prove that the
number of $K$-rational points of height at most $H$ in $C$ is bounded by $c
d^{2}H^{2d_K/d}(\log H)^\kappa$ where $c,\kappa$ are absolute constants. We
also prove analogous results for global fields in positive characteristic, and,
for higher dimensional varieties.
  The quadratic dependence on $d$ in the bound as well as the exponent of $H$
are optimal; the novel aspect is the quadratic dependence on $d$ which answers
a question raised by Salberger. We derive new results on Heath-Brown's and
Serre's dimension growth conjecture for global fields, which generalize in
particular the results by the first two authors and Novikov from the case
$K={\mathbb Q}$. The proofs however are of a completely different nature,
replacing the real analytic approach previously used by the $p$-adic
determinant method. The optimal dependence on $d$ is achieved using a technical
improvement in the treatment of high multiplicity points on mod $p$ reductions
of algebraic curves.
