system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How does the pump at the gas station know when to stop putting fuel in your car?
gpt
Up inside the handle there's a venturi nozzle (a smooth restriction in the tube) that causes a low pressure spot in the fuel line. That venturi is connected by a small tube to a hole near the end of the nozzle. The hole is on the side of the nozzle, not the big hole that the fuel comes out of. While you're pumping fuel the venturi pulls air into that small hole.

When the tank gets full enough that the fuel level comes up to the end of the nozzle, fuel starts to get sucked into that little hole. Fuel is way denser than air. This causes a pressure change inside the handle that actuates a spring-loaded mechanism to shut off the valve inside.