SM UB-40 was a German Type UB II submarine or U-boat in the German Imperial Navy () during World War I.
A Type UB II submarine, UB-40 had a displacement of when at the surface and while submerged. She had a total length of , a beam of , and a draught of . The submarine was powered by two Körting six-cylinder diesel engines producing a total , two Siemens-Schuckert electric motors producing , and one propeller shaft. She was capable of operating at depths of up to .
The submarine had a maximum surface speed of and a maximum submerged speed of . When submerged, she could operate for at ; when surfaced, she could travel at . UB-40 was fitted with two torpedo tubes, four torpedoes, and one Uk L/30 deck gun. She had a complement of twenty-one crew members and two officers and a 42-second dive time.
The U-boat was ordered on 22 July 1915 and launched on 25 April 1916. She was commissioned into the German Imperial Navy on 17 August 1916 as SM UB-40.
The submarine sank 100 ships in 28 patrols. UB-40 was scuttled in Ostend when the German army retreated from Belgium on 5 October 1918.
The wreck of UB-40 has been located & identified by divers in the recent years.