Converting RA and DEC to ALT and AZ

[Root ]




"Today, the latitude and longitude lines govern with more authority than I could have imagined forty odd years ago, for they stay fixed as the world changes its configuration underneath them - with continents adrift across a widening sea, and national boundaries repeatedly redrawn by war or peace"

-Dava Sobel Longitude

This page is concerned with astronomical calculations. You will find out how to calculate the Azimuth (AZ) and Altitude (ALT) of an object in the sky if you know the date, time (UT) and the location of your observing site together with the Right Ascension (RA) and Declination (DEC) of the object. You do not actually need to calculate positions these days - there are lots of computer programs which will do the work for you - but calculating a position at least once may give a better insight into how the coordinate systems work. I tend to reflect on the sheer hard labour involved before the invention of calculators and computers!

As a concrete example, I shall calculate the ALT and AZ of the Messier object M13 for 10th August 1998 at 2310 hrs UT, for Birmingham UK. The RA and DEC of M13 are given as;

            RA  = 16 h 41.7 min
            DEC = 36 d 28   min
according to The Cambridge Star Atlas, and my old school atlas gives the latitude and longitude of Birmingham UK as;
            LAT = 52 d 30 min North
            LONG = 1 d 55 min West

We will need these figures in decimal form, along with the time;

     RA   = 16 h 41.7 min     = 16 + 41.7/60 = 16.695     hrs
     DEC  = 36 d 28   min     = 36 + 28/60   = 36.466667  degs
     Time = 2310 hrs          = 23 + 10/60   = 23.166667  hrs
     LAT  = 52 d 30 min North = 52 + 30/60   = 52.5       degs
     LONG =  1 d 55 min West  = -(1 + 55/60) = -1.9166667 degs

It is a good idea to keep all the decimal places in the figures until the calculation is complete, then round off later on. Notice how Longitudes west are counted as negative, and East counted as positive. We will also need the RA in degrees, not hours. Just multiply the hours figure by 15;

            RA  = 16.695 * 15 = 250.425 degrees

In order to calculate the ALT and AZ of the comet for a given time and place, we need to calculate the Local Siderial Time (LST), and then work out the Hour Angle (HA) of the object. Then we can use some standard formulas from spherical trigonometry to transform the HA and DEC to the ALT and AZ.

If you are not sure what RA and DEC are, or about coordinate systems in general, then the following links might be useful;

I would strongly recommend the book by Peter Duffett-Smith (see Books section below) for further information and calculations, including precession.

Calculator notes


A cheap basic scientific calculator is all that is needed for these calculations - although a programmable calculator can cut the work down if you want to calculate a whole series of positions. A spreadsheet allows you to prepare a list of positions of the object for each hour throughout the day.

When putting numbers into formulas, you must remember;

Days before J2000


Many things (including the siderial time) are measured from a fundamental epoch or date. For most modern astronomical purposes, the reference date is J2000, which corresponds to 1200 hrs UT on Jan 1st 2000 AD, and you can use the table below to find how many days have gone by since J2000 for any date for the next 20 years or so.

Calculating the days from J2000

The tables below can be used to calculate the number of days and
the fraction of a day since the epoch J2000. If you need the
number of Julian centuaries, then just divide the 'day number'
by 36525.

Table A                |  Table B
Days to beginning of   |  Days since J2000 to
month                  |  beginning of each year
Month   Normal   Leap  |  Year   Days    |  Year   Days
        year     year  |                 |
                       |                 |
Jan       0        0   |  1998   -731.5  |   2010  3651.5
Feb      31       31   |  1999   -366.5  |   2011  4016.5
Mar      59       60   |  2000     -1.5  |   2012  4381.5
Apr      90       91   |  2001    364.5  |   2013  4747.5
May     120      121   |  2002    729.5  |   2014  5112.5
Jun     151      152   |  2003   1094.5  |   2015  5477.5
Jul     181      182   |  2004   1459.5  |   2016  5842.5
Aug     212      213   |  2005   1825.5  |   2017  6208.5
Sep     243      244   |  2006   2190.5  |   2018  6573.5
Oct     273      274   |  2007   2555.5  |   2019  6938.5
Nov     304      305   |  2008   2920.5  |   2020  7303.5
Dec     334      335   |  2009   3286.5  |   2021  7669.5

Worked Example

To find the number of days from J2000.0 for 2310 hrs UT on
1998 August 10th, do the following;

1. divide the number of minutes by 60 to obtain the decimal
fraction of an hour, here 10/60 = 0.1666667

2. add this to the hours, then divide the total by 24 to obtain
the decimal fraction of the day, here 23.166667/24 = 0.9652778
This is the first number used below

3. find from table A the number of days to the beginning of
August from the start of the year, here 212 days

4. write down the day number within the month, here 10 above

5. find from table B the days since J2000.0 to the beginning of
the year, here -731.5

6. add these four numbers.

For the date above;

   0.9652778 + 212 + 10 - 731.5 = -508.53472 days from J2000.0

Note that dates which fall before J2000.0 will have negative day
numbers. Keep the negative sign in any calculations.


What is the day number for 15:30 UT, 4th April 2008?
I got 3016.1458 days since J2000.0

Local Siderial Time


Suppose you have a sunny morning. Put a stick in the ground, and watch the shadow. The shadow will get shorter and shorter - and then start to get longer and longer. The time corresponding to the shortest shadow is your local noon. We reckon a Solar day as (roughly) the mean time between two local noons, and we call this 24 hours of time.

The stars keep a day which is about 4 minutes shorter than the Solar day. This is because during one day, the Earth moves in its orbit around the Sun, so the Sun has to travel a bit further to reach the next day's noon. The stars do not have to travel that bit further to catch up - so the siderial day is shorter.

We need to be able to tell time by the stars, and the siderial time can be calculated from a formula which involves the number of days from the epoch J2000. An approximate version of the formula is;

LST = 100.46 + 0.985647 * d + long + 15*UT

      d    is the days from J2000, including the fraction of
           a day
      UT   is the universal time in decimal hours
      long is your longitude in decimal degrees, East positive.

Add or subtract multiples of 360 to bring LST in range 0 to 360
and this formula gives your local siderial time in degrees. You can divide by 15 to get your local siderial time in hours, but often we leave the figure in degrees. The approximation is within 0.3 seconds of time for dates within 100 years of J2000.

Worked Example for LST

Find the local siderial time for 2310 UT, 10th August 1998
at Birmingham UK (longitude 1 degree 55 minutes west).

I know that UT = 23.166667
             d = -508.53472 (last section)
          long = -1.9166667  (West counts as negative)


LST = 100.46 + 0.985647 * d + long + 15*UT
    = 100.46 + 0.985647 * -508.53472 - 1.9166667 + 15 * 23.166667
    = -55.192383 degrees
    = 304.80762 degrees

note how we added 360 to LST to bring the number into the range
0 to 360 degrees.

Hour Angle


We can build in the Earth's rotation by replacing the RA by the Hour Angle. The HA of an object increases with siderial time, but the declination stays the same, as the DEC measures the angle from the Earth's equator. We calculate the HA in degrees, so that we can take sines and cosines later.


If HA negative, then add 360 to bring in range 0 to 360
RA must be in degrees.
As you can see, the HA of the first point of Aries (where RA is 0) is just the LST expressed in degrees.

Worked example of HA

 RA = 250.425 degs
LST = 304.80762

   = 304.80762 - 250.425
   = 54.382617 degs

HA is in correct range, so leave the number

HA and DEC to ALT and AZ


Now we have the RA, DEC and HA for the object, and the Latitude (LAT) of the observing site, the following formulas will give us the ALT and AZ of the object at the current LST.

sin(ALT) = sin(DEC)*sin(LAT)+cos(DEC)*cos(LAT)*cos(HA)

ALT = asin(ALT)

               sin(DEC) - sin(ALT)*sin(LAT)
cos(A)   =   ---------------------------------

A = acos(A)

If sin(HA) is negative, then AZ = A, otherwise
AZ = 360 - A

Note: Certain combinations of declination, latitude and altitude can
give a value of cos(a) that is larger than 1.0, so acos(A) will give
an error. Use the following formula in those cases (or perhaps instead
of the one above).

Y = -cos(dec) * cos(LAT) * sin(HA)

X = sin(DEC) - sin(LAT) * SIN(ALT)

Tan(A') = Y/X

Take the arctan(A').

If X is negative , then A = A' + 180
If X is positive, but Y is negative, then A = A' + 360
Else A = A'

The first formula seems to give trouble in cases where the object
is close to lower culmination (and so an Az close to 0) and has a
high declination. I'm thinking about the celestial sphere and
scribbling diagrams to try and tie this down.

Thanks to Nigel Johnson for raising this case, and I apologise
for any blood pressure increase as a consequence of cos(A) being
larger than 1.0

Worked example of HA and DEC to ALT and AZ

I find it a good idea to use the calculator to find the values of the sines and cosines of the numbers needed first, then calculate the formulas. I record calculations step by step, which makes mistakes easier to find.
HA  =  54.382617
DEC =  36.466667 degrees
LAT =  52.5 degrees (North, so positive)

sin(DEC) = 0.5943550  cos(DEC) = 0.8042028
sin(LAT) = 0.7933533  cos(LAT) = 0.6087614
sin(HA)  is positive  cos(HA)  = 0.5823696

putting the values above into the first formula gives

sin(ALT) = sin(DEC)*sin(LAT)+cos(DEC)*cos(LAT)*cos(HA)

sin(ALT) = 0.5943550 * 0.7933533 + 0.8042028 * 0.6087614 * 0.5823696
         = 0.4715335 + 0.2851093
         = 0.7566428

ALT = 49.169122 degrees

cos(ALT) = 0.6538285

Putting values into the second formula below gives

             sin(DEC) - sin(ALT)*sin(LAT)
cos(A)   = ---------------------------------

            0.5943550 - 0.7566428 * 0.7933533
cos(A)   = ----------------------------------
                   0.6538285 * 0.6087614

         = -----------

         = -0.0148987

    A    = 90.853664

As sin(HA) is positive, the angle AZ is 360 - A

AZ = 360 - 90.853664 degrees
   = 269.14634 degs

You have finished! At 2310 UT on 10th August 1998, from Birmingham UK, M13 will be found at an altitude of 49.2 degrees, and an azimuth of 269.1 degrees (about 6 degrees South of West).

If you want to use setting circles, which are usually calibrated in degrees and minutes, then just convert as follows;

49.169122 degs = 49 d + 0.169122 * 60 min =  49 d 10 min
269.14634 degs = 269 d + 0.14634 * 60 min = 269 d  9 min

Using brackets - formulas on one line

You can write the formula for AZ above all along one line by using brackets to ensure that the 'top' and 'bottom' of the formula get worked out before the division. Having formulas on one line is needed for spreadsheets or BASIC programs. You can enter the 'one line' versions straight into a scientific calculator - but I find I make mistakes that way.

The formula

sin(ALT) = sin(DEC)*sin(LAT)+cos(DEC)*cos(LAT)*cos(HA)
is already on one line - and could be put into a program a it is. The second formula;
              sin(DEC) - sin(ALT)*sin(LAT)
cos(A)   =   ---------------------------------
can be re-written as
cos(A) = (sin(DEC) - sin(ALT)*sin(LAT))/(cos(ALT)*cos(LAT))
where the two pairs of brackets ensure that the calculation is done in the right sequence. Try typing the following right into your calculator (remember to press the '=' button at the end!);
cos(A) = (0.5943550 - 0.7566428 * 0.7933533)/(0.6538285 * 0.6087614)
       = -0.0148987



A copy of Practical Astronomy with your Calculator by Peter Duffett-Smith provides details on the co-ordinate systems and conversion calculations. I have devised programs for my TI-80 programmable calculator based on this book. You don't always want to boot up a PC to work out a rough azimuth for a comet - or to see how far below the horizon the Sun will be at a certain time. Here is the full reference;

Practical Astronomy with your calculator
by Peter Duffett-Smith
Cambridge University Press
ISBN 0 521 28411 2 (2nd edition - 3rd now available)
Cost about UK Pounds 10.

A short review by Sam Wormley of Practical Astronomy with your calculator is available.

The quotation at the head of this page is from;

by Dava Sobel
Fourth Estate, London
ISBN 1-85702-502-4
Cost about UK Pounds 10.

This book deals with the history of the determination of the Longitude at sea and tells the story of the clock maker John Harrison. The author brings the drama of the subject alive - ideal present for people who feel that science and technology are not of humanist concern.

A short review by Sam Wormley of Longitude is available.



As Hale Bopp is both an evening and morning object, try to calculate the ALT and AZ for the comet on 14th March 1997 for Birmingham UK at 19:00 UT. The data are given below;

RA 22h 59.8min  DEC 42d 43min (epoch 1950, BAA comet section)
Days 73
Hours 1900
Long 1d 55min West Lat 52d 30min North
and I got
LST = 6.367592 hrs
ALT = 22.40100 d
AZ  = 311.92258 d
But I cheated by using my TI-80 program! My motivation in doing these calculations was to get the co-ordinates clear, and to understand the formulas before writing a simple program.

[Root ]

Last Modified 10th March 2001
Keith Burnett