Submarine
The Royal Navy commissioned five Holland-class submarines from Vickers, Barrow-in-Furness, under licence from the Holland Torpedo Boat Company from 1901 to 1903. Construction of the boats took longer than anticipated, with the first only ready for a diving trial at sea on 6 April 1902. Although the design had been purchased entirely from the US company, the actual design used was an untested improvement to the original Holland design using a new 180 horsepower (130 kW) petrol engine.
These types of submarines were first used during the Russo-Japanese War of 1904–05. Due to the blockade at Port Arthur, the Russians sent their submarines to Vladivostok, where by 1 January 1905 there were seven boats, enough to create the world's first "operational submarine fleet". The new submarine fleet began patrols on 14 February, usually lasting for about 24 hours each. The first confrontation with Japanese warships occurred on 29 April 1905 when the Russian submarine Som was fired upon by Japanese torpedo boats, but then withdrew.

World War I: Military submarines first made a significant impact in World War I. Forces such as the U-boats of Germany saw action in the First Battle of the Atlantic, and were responsible for sinking RMS Lusitania, which was sunk as a result of unrestricted submarine warfare and is often cited among the reasons for the entry of the United States into the war.
At the outbreak of the war, Germany had only twenty submarines available for combat, although these included vessels of the diesel-engined U-19 class, which had a sufficient range of 5,000 miles (8,000 km) and speed of 8 knots (15 km/h) to allow them to operate effectively around the entire British coast., By contrast, the Royal Navy had a total of 74 submarines, though of mixed effectiveness. In August 1914, a flotilla of ten U-boats sailed from their base in Heligoland to attack Royal Navy warships in the North Sea in the first submarine war patrol in history.
The U-boats' ability to function as practical war machines relied on new tactics, their numbers, and submarine technologies such as combination diesel–electric power system developed in the preceding years. More submersibles than true submarines, U-boats operated primarily on the surface using regular engines, submerging occasionally to attack under battery power. They were roughly triangular in cross-section, with a distinct keel to control rolling while surfaced, and a distinct bow. During World War I more than 5,000 Allied ships were sunk by U-boats.
The British responded to the German developments in submarine technology with the creation of the K-class submarines. However, these submarines were notoriously dangerous to operate due to their various design flaws and poor maneuverability.

World War II: During World War II, Germany used submarines to devastating effect in the Battle of the Atlantic, where it attempted to cut Britain's supply routes by sinking more merchant ships than Britain could replace. These merchant ships were vital to supply Britain's population with food, industry with raw material, and armed forces with fuel and armaments. Although the U-boats had been updated in the interwar years, the major innovation was improved communications, encrypted using the Enigma cipher machine. This allowed for mass-attack naval tactics (Rudeltaktik, commonly known as "wolfpack"), which ultimately ceased to be effective when the U-boat's Enigma was cracked. By the end of the war, almost 3,000 Allied ships (175 warships, 2,825 merchantmen) had been sunk by U-boats. Although successful early in the war, Germany's U-boat fleet suffered heavy casualties, losing 793 U-boats and about 28,000 submariners out of 41,000, a casualty rate of about 70%.
The Imperial Japanese Navy operated the most varied fleet of submarines of any navy, including Kaiten crewed torpedoes, midget submarines (Type A Ko-hyoteki and Kairyu classes), medium-range submarines, purpose-built supply submarines and long-range fleet submarines. They also had submarines with the highest submerged speeds during World War II (I-201-class submarines) and submarines that could carry multiple aircraft (I-400-class submarines). They were also equipped with one of the most advanced torpedoes of the conflict, the oxygen-propelled Type 95. Nevertheless, despite their technical prowess, Japan chose to use its submarines for fleet warfare, and consequently were relatively unsuccessful, as warships were fast, maneuverable and well-defended compared to merchant ships.
The submarine force was the most effective anti-ship weapon in the American arsenal. Submarines, though only about 2 percent of the U.S. Navy, destroyed over 30 percent of the Japanese Navy, including 8 aircraft carriers, 1 battleship and 11 cruisers. US submarines also destroyed over 60 percent of the Japanese merchant fleet, crippling Japan's ability to supply its military forces and industrial war effort. Allied submarines in the Pacific War destroyed more Japanese shipping than all other weapons combined. This feat was considerably aided by the Imperial Japanese Navy's failure to provide adequate escort forces for the nation's merchant fleet.
During World War II, 314 submarines served in the US Navy, of which nearly 260 were deployed to the Pacific. When the Japanese attacked Hawaii in December 1941, 111 boats were in commission; 203 submarines from the Gato, Balao, and Tench classes were commissioned during the war. During the war, 52 US submarines were lost to all causes, with 48 directly due to hostilities. US submarines sank 1,560 enemy vessels, a total tonnage of 5.3 million tons (55% of the total sunk).
The Royal Navy Submarine Service was used primarily in the classic Axis blockade. Its major operating areas were around Norway, in the Mediterranean (against the Axis supply routes to North Africa), and in the Far East. In that war, British submarines sank 2 million tons of enemy shipping and 57 major warships, the latter including 35 submarines. Among these is the only documented instance of a submarine sinking another submarine while both were submerged. This occurred when HMS Venturer engaged U-864; the Venturer crew manually computed a successful firing solution against a three-dimensionally maneuvering target using techniques which became the basis of modern torpedo computer targeting systems. Seventy-four British submarines were lost, the majority, forty-two, in the Mediterranean.

Cold-War military models: The first launch of a cruise missile (SSM-N-8 Regulus) from a submarine occurred in July 1953, from the deck of USS Tunny, a World War II fleet boat modified to carry the missile with a nuclear warhead. Tunny and its sister boat, Barbero, were the United States' first nuclear deterrent patrol submarines. In the 1950s, nuclear power partially replaced diesel–electric propulsion. Equipment was also developed to extract oxygen from sea water. These two innovations gave submarines the ability to remain submerged for weeks or months. Most of the naval submarines built since that time in the US, the Soviet Union (now Russia), the UK, and France have been powered by a nuclear reactor.
In 1959–1960, the first ballistic missile submarines were put into service by both the United States (George Washington class) and the Soviet Union (Golf class) as part of the Cold War nuclear deterrent strategy.
During the Cold War, the US and the Soviet Union maintained large submarine fleets that engaged in cat-and-mouse games. The Soviet Union lost at least four submarines during this period: K-129 was lost in 1968 (a part of which the CIA retrieved from the ocean floor with the Howard Hughes-designed ship Glomar Explorer), K-8 in 1970, K-219 in 1986, and Komsomolets in 1989 (which held a depth record among military submarines—1,000 m (3,300 ft)). Many other Soviet subs, such as K-19 (the first Soviet nuclear submarine, and the first Soviet sub to reach the North Pole) were badly damaged by fire or radiation leaks. The US lost two nuclear submarines during this time: USS Thresher due to equipment failure during a test dive while at its operational limit, and USS Scorpion due to unknown causes.
During the Indo-Pakistani War of 1971, the Pakistan Navy's Hangor sank the Indian frigate INS Khukri. This was the first sinking by a submarine since World War II. During the same war, Ghazi, a Tench-class submarine on loan to Pakistan from the US, was sunk by the Indian Navy. It was the first submarine combat loss since World War II. In 1982 during the Falklands War, the Argentine cruiser General Belgrano was sunk by the British submarine HMS Conqueror, the first sinking by a nuclear-powered submarine in war. Some weeks later, on 16 June, during the Lebanon War, an unnamed Israeli submarine torpedoed and sank the Lebanese coaster Transit, which was carrying 56 Palestinian refugees to Cyprus, in the belief that the vessel was evacuating anti-Israeli militias. The ship was hit by two torpedoes, managed to run aground but eventually sank. There were 25 dead, including her captain. The Israeli Navy disclosed the incident in November 2018.

Usage: 

Military: Before and during World War II, the primary role of the submarine was anti-surface ship warfare. Submarines would attack either on the surface using deck guns, or submerged using torpedoes.