German submarine Wilhelm Bauer (originally designated U-2540) is a Type XXI U-boat of Nazi Germany's navy (Kriegsmarine), completed shortly before the end of World War II.
Due to the ongoing fuel shortages at the end of the war, the boat was relocated to Swinemünde before being scuttled near the Flensburg lightship on 4 May 1945.
On relaunch she was renamed Wilhelm Bauer, after the designer of the first German U-boat, Brandtaucher, built in Kiel by August Howaldt in 1850.
From May 1970 she again entered service, this time with a civilian crew and served as a testbed for the technical innovations of the Type 206 U-boat.
After an underwater collision with the German destroyer Z-3 (D172) on 6 May 1980 Wilhelm Bauer was discharged from use at Eckernförde on 18 November 1980 and finally released from service in 1983.