UD-4 was an . The boat was laid down as the Dutch submarine HNLMS K XXVI and renamed HNLMS O 26 but was captured during German invasion of the Netherlands in World War II and commissioned in the Kriegsmarine.
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.[1]
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,[1] with Korvettenkapitän Helmut Brümmer-Patzig in command.
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.[1]
On 19 March 1945, UD-4 was decommissioned. On 3 May 1945, she was scuttled in Kiel.[1]