Context. The mass function of supermassive black holes in our cosmic neighborhood is required to understand the statistics of their activity and consequently the origin of ultra high energy particles. Aims. We determine a mass function of supermassive black hole candidates from the entire sky except for the Galactic plane. Methods. Using the 2MASS catalogue as a starting point, and the well-established correlation between black hole mass and the bulge of old population of stars, we derive a list of nearby black hole candidates within the redshift range z < 0.025, then perform an additional selection based on the Hubble type. We present our resulting catalogue elsewhere. The final list of black hole candidates above a mass of M BH > 3 × 10 6 M has 5829 entries. We perform a Hubble-type correction to account for selection effects, which reduces this number to 2919 black hole candidates. Here we use this catalogue to derive the black-hole mass function. We also correct for volume, so that this mass function is a volume-limited distribution to redshift 0.025. Results. The differential mass function of nearby black hole candidates is a curved function, with a straight simple power-law of index −3 above 10 8 M that becomes progressively flatter towards lower masses, turns off towards a gap below 3 × 10 6 M , and then extends into the range where nuclear star clusters replace black holes. The shape of this mass function can be explained in a simple merger picture. Integrating this mass function over the redshift range for which it has been derived, infers a total number of black holes with z < 0.025, and M BH > 10 7 M of about 2.4 × 10 4 , or, if we average uniformly, 0.6 for every square degree on the sky.