Warmer molecules are more energised, so they move around more and thus end up generally being further apart from each other on the whole. This increases the volume of the same mass, meaning it’s less dense.
In other words, there’s the same amount of air, but it takes up more space when it’s warm than when it’s cool.
You’re right it doesn’t change the mass, but it does change the volume that mass takes up – which means it changes the *density*. And it’s density not mass that determines whether things float or sink.
Hot air rises because it is less dense than cold air. Like, 1 pound of hot air takes up more space than 1 pound of cold air. That means the hot air is less dense and floats on top of colder air the same way a cork will float on water – because it’s less dense.
Heating air raises its pressure. Cooling air reduces its pressure. Temperature = jiggling. More jiggling, more pressure. But, gases only increase in pressure when constrained. Hot air surrounded by earth’s atmosphere will instead occupy more volume rather than increase pressure. This increased volume lowers the air’s density, causing it to float higher until it cools off.
Increased temperature does increase mass, very slightly. In most situations, the effect is immeasurably small and irrelevant. This is because of mass energy equivalence. It just turns out that a little bit of mass is a lot of energy.
Imagine each air molecule is a bouncy ball.
If you bounce a bouncy ball hard (put more energy into it) it bounces further. Molecules that are hotter have more energy, so they bounce off each other more and therefore are further apart. Like a bouncy ball being higher off the floor the harder you throw it.
So the further apart the molecules are, the less dense the air is and the more space it takes up, meaning more pressure. Less dense things float on top of more dense things because gravity pulls more on denser objects.
Latest Answers