Suppose I am moving in a certain compass bearing (e.g. $270^\circ$) and I want to be going in a different direction (e.g. $120^\circ$). Is there a formula or series of math operations that I can use to determine which direction I should turn (I want the shorter direction)?

I've tried to increase my angle, i.e. turn counterclockwise, if $\text{target bearing} - \text{current bearing} < 360 - (\text{target bearing} - \text{current bearing})$, and it only seems to work in some cases.

Please help! I've been having lots of trouble.

  • $\begingroup$ I've edited this as I understand it. If I interpreted your question incorrectly, please change it or let me know. $\endgroup$
    – davidlowryduda
    Feb 16, 2012 at 18:10
  • $\begingroup$ That's correct, thanks. As you might guess, English isn't my mother tongue. :D $\endgroup$
    – Ruuhkis
    Feb 16, 2012 at 18:33

3 Answers 3


Let $T$ be the target bearing and $C$ be the current bearing. Let's consider three numbers:

$$\begin{align}\alpha&=T-C\\ \beta&=T-C+360°\\ \gamma&=T-C-360°\end{align}$$

Now, whichever of $|\alpha|$, $|\beta|$, and $|\gamma|$ is the smallest tells us which of $\alpha$, $\beta$, and $\gamma$ is relevant and if the one with the smallest absolute value is positive, go clockwise, and if it's negative, go counterclockwise.

edit The animation below shows the locations of the target point in red and the current point in blue, for various values of each, with the values of $|\alpha|$, $|\beta|$, and $|\gamma|$ as well as the motion (which is indicated by an arc along the circle) shown in the lower right corner.

enter image description here

  • $\begingroup$ This is absolutely best answer one can ever get! Thanks for amazing visualizing too, I am more of visual learner. :) Couldn't thank you enough! $\endgroup$
    – Ruuhkis
    Feb 17, 2012 at 7:28

If you're looking for a "one-liner", let $T$ be the target bearing and $C$ be the current bearing:


The shortest rotation distance in degrees is given by $\delta$. Positive values indicate clockwise rotation, negative values indicate counterclockwise rotation.

$180°$ turns are always expressed as counterclockwise $-180°$.

  • $\begingroup$ Awesome, thanks! $\endgroup$ Aug 30, 2018 at 9:03

Say you're going at bearing $a$ and your target bearing is $b$. I'll assume that both $a$ and $b$ are between zero (inclusive) and 360 (exclusive), and I'll also assume that the direction of increasing bearing is counterclockwise (that's the usual convention in higher math, and I think it's the one you are using). Here are the cases:

If $a\lt b$, and $b-a\le180$, turn counterclockwise.

If $a\lt b$, and $b-a\gt180$, turn clockwise.

If $a\gt b$, and $a-b\le180$, turn clockwise.

If $a\gt b$, and $a-b\gt180$, turn counterclockwise.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .