  We prove an effective form of Hilbert's irreducibility theorem for
polynomials over a global field $K$. More precisely, we give effective bounds
for the number of specializations $t\in \mathcal{O}_K$ that do not preserve the
irreducibility or the Galois group of a given irreducible polynomial $F(T,Y)\in
K[T,Y]$. The bounds are explicit in the height and degree of the polynomial
$F(T,Y)$, and are optimal in terms of the size of the parameter $t\in
\mathcal{O}_K$. Our proofs deal with the function field and number field cases
in a unified way.
