We investigate maximal tori in the Hochschild cohomology Lie algebra $HH^1(A)$ of a finite dimensional algebra $A$, and their connection with the fundamental groups associated to presentations of $A$. We prove that every maximal torus in $HH^1(A)$ arises as the dual of some fundamental group of $A$, extending work of Farkas, Green and Marcos; de la Pe~na and Saorin; and Le Meur. Combining this with known invariance results for Hochschild cohomology, we deduce that (in rough terms) the largest rank of a fundamental group of $A$ is a derived invariant quantity, and among self-injective algebras, an invariant under stable equivalences of Morita type. Using this we prove that there are only finitely many monomial algebras in any derived equivalence class of finite dimensional algebras; hitherto this was known only for very restricted classes of monomial algebras.