A path in the hypercube Qn is said to be a geodesic if no two of its edges are in the same direction. Let G be a subgraph of Qn with average degree d. How long a geodesic must G contain? We show that G must contain a geodesic of length d. This result, which is best possible, strengthens a theorem of Feder and Subi. It is also related to the `antipodal colourings' conjecture of Norine.