  For a non-CM elliptic curve $E$ defined over $\mathbb{Q}$, the Galois action
on its torsion points gives rise to a Galois representation $\rho_E:
Gal(\overline{\mathbb{Q}}/\mathbb{Q})\to GL_2(\widehat{\mathbb{Z}})$ that is
unique up to isomorphism. A renowned theorem of Serre says that the image of
$\rho_E$ is an open, and hence finite index, subgroup of
$GL_2(\widehat{\mathbb{Z}})$. We describe an algorithm that computes the image
of $\rho_E$ up to conjugacy in $GL_2(\widehat{\mathbb{Z}})$; this algorithm is
practical and has been implemented. Up to a positive answer to a uniformity
question of Serre and finding all the rational points on a finite number of
explicit modular curves of genus at least $2$, we give a complete
classification of the groups $\rho_E(Gal(\overline{\mathbb{Q}}/\mathbb{Q}))\cap
SL_2(\widehat{\mathbb{Z}})$ and the indices
$[GL_2(\widehat{\mathbb{Z}}):\rho_E(Gal(\overline{\mathbb{Q}}/\mathbb{Q}))]$
for non-CM elliptic curves $E/\mathbb{Q}$. Much of the paper is dedicated to
the efficient computation of modular curves via modular forms expressed in
terms of Eisenstein series.
