*same as others have mentioned: use leveling, replay gain, loudness compensation etc.
Note: this somewhat crude technique ain't gonna work with IEMs or earbuds...
I usually just compare with what is the base max volume I already have for my speakers -- and copy the same for the HP by adjusting the HP amp and fixing it there (in the ff. case it's at 12 o'clock). If you've got a cheap hand-held SPL meter for speakers, and (preferrably) have EQ'd your HP close to flat and neutral, you could use that same meter and squeeze it in-between your HP. Your speakers and HP should sound close to the same loudness. With the open-back HPs I have tested, it gets very close to what I'm getting at with my real speakers:
KH120 + Sub at listening position max loudest SPL recorded for the track (yes, you can use pink noise just as well)
So I'm Growing Old on Magic Mountain by Father John Misty
DT990 Pro + JDS Labs OL-DAC at 12 o'clock
Playing in parallel (HP and speakers) and muting the speakers occasionally, the two sound very close to having the same loudness in my ears.
From my experience, this works best if you've actually EQ'd your HPs very close to flat/neutral -- or if your HP are already very close to neutral.
No, I very rarely listen at such high volumes, but it's tolerable enough if I really wanted to do so for an hour or two... but not any longer.