For various 2-Calabi-Yau categories C for which the stack of objects M has a good moduli space p : M → M, we establish purity of the mixed Hodge module complex p ! Q M . We do this by using formality in 2CY categories, along with étale neighbourhood theorems for stacks, to prove that the morphism p is modelled étale-locally by the semisimplification morphism from the stack of modules of a preprojective algebra. Via the integrality theorem in cohomological Donaldson-Thomas theory we prove purity of p ! Q M . It follows that the Beilinson-Bernstein-Deligne-Gabber decomposition theorem for the constant sheaf holds for the morphism p, despite the possibly singular and stacky nature of M. We use this to define cuspidal cohomology for M, which is conjecturally a complete space of generators for the BPS algebra associated to C .We prove purity of the Borel-Moore homology of the moduli stack M, provided its good moduli space M is projective, or admits a suitable contracting C * -action. In particular, when M is the moduli stack of Gieseker-semistable sheaves on a K3 surface, this proves a conjecture of Halpern-Leistner. We use these results to moreover prove purity for several stacks of coherent sheaves that do not admit a good moduli space.Without the usual assumption that r and d are coprime, we prove that the Borel-Moore homology of the stack of semistable degree d rank r Higgs sheaves is pure and carries a perverse filtration with respect to the Hitchin base, generalising the usual perverse filtration for the Hitchin system to the case of singular stacks of Higgs sheaves.