Captain is the name most often given in English-speaking navies to the rank corresponding to command of the largest ships. The rank is equal to the army rank of colonel.
Equivalent ranks worldwide include "ship-of-the-line captain" (e.g. France, Argentina, Spain), "captain of sea and war" (e.g. Portugal), "captain at sea" (e.g. Germany, Netherlands) and "captain of the first rank" (Russia).
The NATO rank code is OF-5, although the United States of America uses the code O-6 for the equivalent rank (as they do for all OF-5 ranks).
Captain (naval) Wikipedia
Any naval officer who commands a ship is addressed by naval custom as "captain" while aboard in command, regardless of his or her actual rank, even though technically an officer of below the rank of captain is more correctly titled the commanding officer, or C.O. Officers with the rank of captain travelling aboard a vessel they do not command should be addressed by their rank and name (e.g., "Captain Smith"), but they should not be referred to as "the captain" to avoid confusion with the vessel's captain. The naval rank should not be confused with the army, air force, or marine ranks of captain, which all have the NATO code of OF-2.
US Navy traditions
On large US ships (e.g., aircraft carriers), the executive officer (XO) may be a captain in rank, in which case it would be proper to address him by rank. Often the XO prefers to be called "XO" to avoid confusion with the CO, who is also a captain in rank and the captain of the ship. The same applies to aircraft carriers in the U.S. Navy, where the commander and deputy commander of the embarked carrier air wing are both captains in rank, but are addressed by the titles of "CAG" and "DCAG", respectively.
Captains with sea commands generally command ships of cruiser size or larger; the more senior the officer, the larger the ship, but ship commanders do not normally hold a higher rank than captain. In the Royal Navy, a captain might command an aircraft carrier, an amphibious assault ship, or the Ice Patrol Ship, while naval aviator and naval flight officer captains in the U.S. Navy command aircraft carriers, large-deck amphibious assault ships, carrier air wings, maritime patrol air wings, and functional and specialized air wings and air groups.
Maritime battlestaff commanders of one-star rank (commodores or rear admirals lower half) will normally embark on large capital ships such as aircraft carriers, which will function as the flagship for their strike group or battle group, but a captain will retain command of the actual ship, and assume the title of "flag captain". Even when a senior officer who is in the ship's captain's chain of command is present, all orders are given through the captain.
Captains in national navies
The following articles deal with the rank of captain as it is used in various navies.Captain (Canada)
Captain (United Kingdom)
Captain (U.S. Navy)
Capitaine de vaisseau (France)
Kapitän zur See (Germany)
Kapitan of the 1st rank (Капитан первого ранга) (Russia)