Captain is a military Rank, the equivalent of which is used by the service organizations of many civilizations. The title of Captain is often used by vessel commanders and, as a naval rank, in many earth navies and Starfleet, is above Commander but below Commodore. As an infantry rank, captains rank subordinate to a major and above a first lieutenant.
By the mid 22nd century, captain was a senior line officer rank of most space services and usually given to the commanding officers of starships. This naval rank is equivalent to the infantry rank of colonel, the Folian Star Empire's Major grade, the Candorian Union's title of Li’ass and the Ferengi Alliance's quasi-military DaiMon title.
On starships, the term captain is also often used as a synonym to commanding officer. Proper naval parlance says that, even if a vessel is commanded by an officer whose rank is lower than captain, that officer is still able to be referred to as a captain while on the deck of their own vessel, no matter their literal commissioned rank.
Captains of starships, often located hundreds of light years away from and out of communications with higher authority, must be able to function autonomously and make independent command decisions affecting Federation policy and countless lives. Accordingly, few Starfleet officers ever gain the captaincy of a starship, the result of decades of sustained excellence as a Starfleet leader. A senior captain given a large degree of responsibility or administrative assignment is sometimes given the title of fleet captain.