How do big planes like 737 manage fresh air for passengers during flight? How do the big planes (e.g. A380 or 737) flying on high altitudes manage to get fresh air for passengers and crew during the flight?

I know the inner space of the plane used for passengers and crew is sealed and the pressure is maintained within some range.

However in standard flight altitude of about 10-14 km there is not enough oxygen to breathe.  I am not sure whether the standard oxygen ratio is still about 21% and you only have less air (lower pressure).

We talked two possible solutions and maybe I am still wrong:


using some pumps and small pressure tanks to suck in air from outside till we get higher pressure and then use some valves to "replace" the breathed up air with the fresh one
use some pressure tanks loaded with oxygen + some cleaning devices to clean the air and add oxygen to keep the same oxygen level - but this would need to get the oxygen before take-off and such tanks would be really dangerous


So how is it in reality?
They bleed hot compressed air from inside the jet engines, cool it down and pass it into the cabin. There are outlet valves in the fuselage that allow stale air out and which control cabin pressure and air-refresh rates.

A few aircraft types, such as the 787, now use a compressor to take in air from under the aircraft. They do this because it can be more fuel-efficient (not for any other reason). It is arguable whether it creates an additional fire hazard.

See also 


Why is the compressed air (from Engine Compressors) taken from High Pressure (HP) stage instead of Low Pressure (LP) stage
Can an aircraft re-pressurize at high altitude?
Is constant air pressure maintained inside the fuselage?