Abstract. We study congruences between newforms in the spaces S 4 (Γ 0 (p), Z p ) for primes p. Under a suitable hypothesis (which is true for all p < 5000 with the exception of 139 and 389) we provide a complete description of the congruences between these forms, which leads to a formula (conjectured by Calegari and Stein) for the index of the Hecke algebra T Z p in its normalization. Since the hypothesis is amenable to computation, we are able to verify the conjectured formula for p < 5000. In 2004 Calegari and Stein gave a number of conjectures which provide an outline for the proof of this formula, and the results here clarify the dependencies between the various conjectures. Finally, we discuss similar results for the spaces S 6 (Γ 0 (p), Z p ).