U-31 may refer to one of the following German submarines:

, was the lead ship of the Type U 31 class of submarines; launched in 1914 and served in the First World War until sunk on 13 January 1915 During the First World War, Germany also had these submarines with similar names: , a Type UB II submarine launched in 1915 and sunk on 2 May 1918 , a Type UC II submarine launched in 1916 and surrendered on 26 November 1918 , a Type VIIA submarine that served in the Second World War until sunk on 2 November 1940 , a Type 212 submarine of the Bundesmarine that was launched in 2002 and still in service