The modular class of a regular foliation is a cohomological obstruction to the existence of a volume form transverse to the leaves which is invariant under the flow of the vector fields of the foliation. It has been used in dynamical systems and operator theory, from which the name modular comes from. By drawing on the relationship between Lie algebroids and regular foliations, this paper extends the notion of modular class to the realm of singular foliations. The singularities are dealt with by replacing the singular foliations by any of their universal Lie ∞-algebroids, and by picking up the modular class of the latter. The geometric meaning of the modular class of a singular foliation F is not as transparent as for regular foliations: it is an obstruction to the existence of a universal Lie ∞-algebroid of F whose Berezinian line bundle is a trivial F -module. This paper illustrates the relevance of using universal Lie ∞-algebroids to extend mathematical notions from regular foliations to singular ones, thus paving the road to defining other characteristic classes in this way.