Due to its low weight, hydrogen has the best mass-based energy density of all fuels. Below, some weight-based (gravimetric) heating values are listed for comparison.

The volume-based (volumetric) energy density of hydrogen at atmospheric pressure, however, is comparatively low compared to other known energy carriers. Therefore, hydrogen is stored under high pressure in most applications — in cars, for example, at approximately 700 bar. The energy required for compression to 700 bar is approximately 10% of the hydrogen's heating value.
To make these energy densities under pressure comparable, the following calculator can be used to calculate the energy density of hydrogen under pressure. All calculations are performed using real gas parameters and are based on the heating values of the substances.
The calculator shows that hydrogen, despite compression, cannot compete with fossil fuels from a volumetric perspective. Therefore, volumetrically larger containers than for liquid fuels (gasoline, diesel) are typically used in mobile applications.
All online tools have been programmed to the best of my knowledge; however, errors cannot be entirely excluded. Any use is therefore at your own risk. Any legal or financial claims are excluded.