|This article does not cite any references or sources. (December 2009)|
An airlock is a device which permits the passage of people and objects between a pressure vessel and its surroundings while minimizing the change of pressure in the vessel and loss of air from it. The lock consists of a small chamber with two airtight doors in series which do not open simultaneously.
An airlock may be used for passage between environments of different gases rather than different pressures, to minimize or prevent the gases from mixing.
An airlock may also be used underwater to allow passage between an air environment in a pressure vessel and a water environment outside, in which case the airlock can contain air or water. This is called a floodable airlock or an underwater airlock, and is used to prevent water from entering a submersible vessel or an underwater habitat.
Before opening either door, the air pressure of the airlock—the space between the doors—is equalized with that of the environment beyond the next door to open. This is analogous to a waterway lock: a section of waterway with two watertight gates, in which the water level is varied to match the water level on either side.
A gradual pressure transition minimizes air temperature fluctuations (see Boyle's law), which helps reduce fogging and condensation, decreases stresses on air seals, and allows safe verification of pressure suit and space suit operation.
Where a person who is not in a pressure suit moves between environments of greatly different pressures, an airlock changes the pressure slowly to help with internal air cavity equalization and to prevent decompression sickness. This is critical in scuba diving, and a diver may have to wait in an airlock for some hours, in accordance with decompression tables.
Airlocks are used in
- aviation, certain airplanes are equipped with airlocks for skydiving, and/or emergency exits.
- spacecraft and space stations, to maintain the habitable environment when persons are exiting or entering the craft.
- hyperbaric chambers, to allow entry and exit while maintaining the pressure difference with the surroundings.
- submarines, diving chambers, and underwater habitats to permit divers to exit and enter.
- torpedo tubes and escape trunks in submarines are airlocks.
- cleanrooms, protected environments in which dust, dirt particles, and other contaminants are excluded partially by maintaining the room at a higher pressure than the surroundings.
- hazardous environments, such as nuclear reactors and some biochemical laboratories, in which dust and particles are prevented from leaking out by maintaining the room at a lower pressure than the surroundings.
- pressurized domes such as the USF Sun Dome and BC Place Stadium, where pressure loss would cause collapse of the structure.
- electron microscopes, where the interior is near vacuum so air does not affect the electron path.
- parachute airlocks, where airfoil collapse due to depressurization can result in dangerous loss of altitude.
- On oil rigs/platforms in rooms with overpressure to avoid pressure alarm from going off.
- fermentation vessels, where a fermentation lock allows fermentation gases to escape while keeping air out, such as in brewing or wine-making.
Similar mechanisms 
- In cold climates, two doors arranged in an airlock configuration are common in building entrances. While not airtight, the double doors minimize the loss of heated air from the building. A similar arrangement is common in hot climates, where it is used to keep interior spaces cool. Revolving doors may be used for the same purpose.
- Some jewelry stores and banks have airlock-like doors to slow the escape of thieves.
- Butterfly farms and aviaries usually have an airlock-like entrance to prevent the exit of inhabitants and entrance of predatory species.
Fictional airlocks 
A four-door airlock (with three interior chambers) was proposed by science fiction writer H. Beam Piper in his novel Uller Uprising. The atmosphere inside the fictional structure was human-breathable, while the outside atmosphere was highly toxic. Only one door of the airlock opened at a time, and the middle chamber of the three would always contain a vacuum to minimize traces of the exterior atmosphere reaching the habitat.
Airlocks are also used in the Bioshock game series for entrance and exit into water environments.
Airlocks are a common feature in the reimagined Battlestar Galactica, as a common method of execution used by the Colonial Humans.