SM UB-31 was a German Type UB II submarine or U-boat in the German Imperial Navy () during World War I. The U-boat was ordered on 22 July 1915 and launched on 16 November 1915. She was commissioned into the German Imperial Navy on 25 March 1916 as SM UB-31. The submarine sank 26 ships in 25 patrols. UB-31 was depth charged and sunk by British warships HMS Lord Leitrim, HMS Loyal Friend, and HMS Ocean Roamer in the English Channel on 2 May 1918.