The submarine was ordered on 24 June 1938 and laid down on 20 April 1939 as K XXVI at the Rotterdamsche Droogdok Maatschappij, Rotterdam. During construction she was renamed O 26. Following the German invasion of 10 May 1940, the not yet launched O 26 was captured at the yard by the invading forces.[8]
The Germans decided to complete her. The launch took place on 23 November 1940. She served in the Kriegsmarine as UD-4 and was commissioned on 28 January 1941,[8] with KorvettenkapitänHelmut Brümmer-Patzig in command.[9]
From January to April 1941, UD-4 served as school boat in Kiel when attached to the 1st Flotilla. In May, she was transferred to the 3rd Flotilla also in Kiel where she was used as a trial boat. She remained there until July that year. In August 1941, the boat was transferred to the 5th Flotilla also in Kiel where she was used as a school boat until December 1942. In January 1943, UD-4 was transferred to Gotenhafen where she served as a school boat for 24th Flotilla and 27th Flotilla until January 1945. From January to March 1945, she was based in Hela and transferred to the 18th Flotilla where she served as a school boat.[8]
On 19 March 1945, UD-4 was decommissioned. On 3 May 1945, she was scuttled in Kiel.[8]
Busch, Rainer; Röll, Hans-Joachim (1999). German U-boat commanders of World War II : a biographical dictionary. Translated by Brooks, Geoffrey. London, Annapolis, Md: Greenhill Books, Naval Institute Press. ISBN978-1-55750-186-8.
Gröner, Erich; Jung, Dieter; Maass, Martin (1991). German Warships 1815–1945, U-boats and Mine Warfare Vessels. Vol. 2. Translated by Thomas, Keith; Magowan, Rachel. London: Conway Maritime Press. ISBN978-0-85177-593-7.