In this study, an analytical algorithm for collision avoidance is proposed, which is applicable to designing collision avoidance maneuvers for two encountering ships. The minimum separation distance is defined and an appropriate maneuver sequence is computed for safe and effective collision avoidance. Two approaches: 1) collision avoidance through speed change and 2) collision avoidance through heading change, are considered, and the initiation point of the avoidance maneuver is computed analytically using the geometric configuration of the two encountering ships. To verify the feasibility of the proposed algorithm, numerical simulations are carried out using a set of ship-to-ship encountering scenarios.