Gas or petrol pump nozzles turn off automatically when your tank is full. The way it works is really clever and uses the venturi effect.Most modern pumps have an automatic cut-off feature that stops the flow when the tank is full.
This is done with an auxiliary sensing tube running from just inside the mouth of the nozzle to a Venturi pump in the pump handle. A mechanical valve in the pump handle detects a change of pressure and closes, preventing the flow of fuel.
The Venturi effect is the physical phenomenon that causes the gas pump to automatically shut off when the tank is full. The Venturi effect occurs when the density of a fluid is greater than the density of the air.When the level of gasoline reaches the level of the hole in the gas pump nozzle, the Venturi tube experiences a change in fluid pressure.
As a result, the diaphragm collapses slightly and an automatic shut-off of the flow of gasoline through point A occurs. A breakaway valve is also fitted to the hose so that the nozzle and hose will detach and fuel flow stop if a motorist drives off with the nozzle still in the filler./wikipedia