No. 40 Squadron RNZAF is a transport squadron in the Royal New Zealand Air Force (RNZAF). Established in June 1943, it remains on active duty.
 The squadron was formed at Whenuapai on 1 June 1943 as No. 40 Transport Squadron RNZAF. It was equipped with Dakota and Lockheed Lodestars and carried men and supplies to forward areas throughout the Pacific theatre. Within the squadron organisation was a ferry flight of aircrew which regularly flew delivery flights from the mainland United States and Hawaii to New Zealand of new aircraft such as the Catalina flying boat and Ventura. The squadron was disbanded on 31 October 1947 and most of its crews and aircraft were transferred to the government-owned National Airways Corporation.
 No. 40 Squadron reformed on 8 December 1954 with four Handley Page Hastings which had previously been operated by No. 41 Squadron RNZAF. The Squadron was supplemented with three Douglas DC-6 acquired from the defunct Australian airline, British Commonwealth Pacific Airlines by 1961.  The three current Lockheed C-130H Hercules were purchased in 1965 and two more in 1968.
 Three Boeing 727s were purchased second hand from Boeing in 1981, all ex-United Airlines.  NZ7271 19892 entered service in July 1981 and was retired on 7 July 2003. (It became 3D-KMJ and then 9Q-CMP in Africa and was scrapped in 2005). NZ7272 19893 entered service in July 1981 and was retired to Woodbourne as an instructional airframe on 25 August 2003.  NZ7273 19895 was the first 727 delivered, on 6 May 1981, but flew only 21 hours, being intended from the start to be a source of spare parts. It was retired 25 June 1981. The 727s were purchased by the administration of Sir Rob Muldoon and used by the fourth and fifth Labour governments, as well as the administration of Jenny Shipley. The Boeing 727s were replaced in 2003 by two Boeing 757s.
 Located at RNZAF Base Whenuapai 40 Squadron today operates five C-130H(NZ) Hercules and two Boeing 757-2K2's.
 The squadron saw action throughout the Pacific War against Japan, helped supply New Zealand forces fighting in Korea, Malaya, Vietnam, East Timor, Afghanistan, and Iraq, and provided transport to United States and United Kingdom forces in the 1990 Gulf War.
 Humanitarian missions have included flying in the first Cyclone Tracy relief supplies to Darwin, assisting victims of the Bali bombing and the Boxing Day tsunami. Since the late 1960s the squadron has detached aircraft each summer to work in the Ross Dependency of Antarctica. During the period 29 November to 12 December 1979, the squadron flew flights to Antarctica in support of body recovery operations associated with the Air New Zealand Flight 901 DC-10 crash which impacted the slopes of Mt Erebus with the loss of all 257 lives.
 A major operation for the squadron was the 2011 Christchurch earthquake which saw nearly the entire fleet working around the clock distributing personnel, freight, SAR teams and medical supplies to the people of Christchurch. 40 Squadron aircraft worked in conjunction with C-130s from the Republic of Singapore Air Force[clarification needed], Royal Australian Air Force, and U.S. Air Force.
 40 Squadron is held in high regard internationally having won various tactical flying competitions in the USA competing against other air forces in exercises such as Green Flag East at Little Rock Air Force Base, Arkansas.
 In 2003 two second-hand Boeing 757s were purchased from Transavia, which 40 Squadron operate in transport, freight, cargo and troop movement roles. They can also be converted for medical use in emergencies. Their registrations are NZ7571 and NZ7572.
 The RNZAF is now looking at replacement aircraft for the 757s, a decision was expected in 2021 but has been delayed until 2028 at the earliest.
 The RNZAF purchased the three first ever, H model Hercules (NZ 7001, NZ 7002, NZ 7003) from the US in April 1965 and then another two aircraft (NZ 7004, and NZ 7005) in 1968. Since the introduction of the type they have been involved extensively carrying freight, troops, and providing humanitarian relief to countries all over the world.
 In 2008, the squadron began modernising its Hercules aircraft with new avionics, centre wing refurbishment, aircraft systems upgrade, and complete re-wiring and replacement of major parts and interior to extend their life expectancy (for NZ$234 million).
 The package for each aircraft was known as the Life Extension Programme (LEP). Initially two aircraft were completed in Canada however the programme ran into difficulties when the company tasked with carrying out the refurbishments went into receivership. The remaining aircraft were then completed by Safe Air in Blenheim, New Zealand.
 The Hercules fleet now operate with glass cockpits and had one of the most extensive upgrades ever completed on this type of aircraft anywhere in the world.
 The Boeing 757s were also upgraded with new avionics and more powerful engines. A cargo door was also fitted to allow pallet loading and an aero medical facility if needed.
 Since 2015 the RNZAF has been looking to replace the C-130 Hercules fleet and the Boeing 757s. The Lockheed Martin C-130J Super Hercules was announced as the replacement for the C-130Hs in June 2019. The RNZAF opted for the stretched C-130J-30 model that has an extra 4.6-metre longer fuselage, providing space for an additional two pallets of extra freight. The aircraft will be delivered from mid 2024.
 Some of the aircraft under consideration by the RNZAF for replacement of the Boeing 757s include the Airbus A400M, Kawasaki C-2 and Embraer KC-390.