A deck gun is a type of naval artillery mounted on the deck of a submarine. Most submarine deck guns were open, with or without a shield; however, a few larger submarines placed these guns in a turret.
British Mk XXII 4-inch deck gun from S-class submarine
5"/25 caliber gun on the deck of Balao-class submarine USS Bowfin
Bofors 102 mm/4-inch naval gun from the Romanian submarine Delfinul
The 5"/25 caliber gun entered service as the standard heavy anti-aircraft (AA) gun for United States Washington Naval Treaty cruisers commissioned in the 1920s and 1930s. The goal of the 5"/25 design was to produce a heavy AA gun that was light enough to be rapidly trained manually. The gun was also mounted on pre-World War II battleships and aircraft carriers until replaced by the standard widespread dual-purpose 5"/38 caliber gun, which was derived from the 5"/25. Guns removed from battleships were probably converted for submarine use by late 1943, while a purpose-built variant for submarines was available in mid-1944, and was widely used by them. United States naval gun terminology indicates the gun fired a projectile 5 inches (127 mm) in diameter, and the barrel was 25 calibers long. It is referred to sometimes as a dual purpose gun and sometimes as an anti-aircraft gun, because of its comparative weakness against surface targets.
On the deck of Balao-class submarine USS Bowfin
Battleship USS New Mexico's 5"/25 battery prepares to fire during the bombardment of Saipan, 15 June 1944