I am an astro-particle physics PhD student trying to look for a simulation.

I was looking for a conversion formula for sky (or celestial or Equatorial) coordinate system using Right Ascension and Declination to l and b (galactic longitude and latitude).

Of course, since sky coordinate cannot contain Earth rotation or evolution effect, I also have UTC time for specific time.

Can anyone tell me the formula of RA, Dec and UTC to l and b?

Thanks in advance.

  • 3
    $\begingroup$ The conversion from RA and Dec to l and b does not depend on time (other than the equinox). $\endgroup$
    – ProfRob
    Commented Apr 12, 2023 at 21:10

3 Answers 3


Applying spherical trigonometry, it follows that the conversion from equatorial coordinates $\alpha$ and $\delta$ to galactic coordinates $l$ and $b$ is:

$$\left. \begin{aligned} \sin b &=\sin \delta_{NGP} \sin \delta + \cos \delta_{NGP} \cos \delta \cos ( \alpha - \alpha_{NGP}) \\ \sin ( l_{NCP}-l) &=\dfrac{\cos \delta \sin ( \alpha - \alpha_{NGP})}{\cos b} \\ \cos ( l_{NCP}-l) &=\dfrac{\cos \delta_{NGP}\sin \delta - \sin \delta_{NGP} \cos \delta \cos ( \alpha - \alpha_{NGP})}{\cos b} \end{aligned} \right \}$$

The equatorial coordinates (J2000) of the North Galactic Pole are:

$\alpha_{NGP}=12^h 51^m 26.282^s=192.8595º=3.36603 \ rad$

$\delta_{NGP}=+27º 07’ 42.01’’=27.1283º=0.473479 \ rad$

And the galactic longitude of the North Celestial Pole is:

$l_{NCP}=122.932º=2.14557 \ rad$


Galactic coordinate system. (Scientific Library)

Additional bibliography:

Reconsidering the Galactic coordinate system

Transformation of the equatorial proper motion to the Galactic system

Best regards.


This can be pretty easily accomplished in astropy using the following code:

import astropy.units as u
import astropy.time
import astropy.coordinates

coord = astropy.coordinates.TETE(
    ra=25 * u.deg,
    dec=45 * u.deg,

coord = coord.transform_to(astropy.coordinates.Galactic())

print(coord.l.deg, coord.b.deg)

which outputs

131.65579483995242 -17.18683219126681

It works by specifying the right ascension and declination in the True Equator True Equinox coordinate system (known as astropy.coordinates.TETE) and then using the transform_to() method to convert the coordinates into galactic coordinates.


I actually made a converter for myself, with help from some old website that may not be around anymore. I think this may be what you're looking for: https://docs.google.com/spreadsheets/d/1wneDrG5xUMr1jMfPPOVLxPzkT72EMKj6dh52dzEHVAk/edit?usp=sharing

The J2K (Right Ascension and Declination) part is all the way at the bottom, I'm afraid; I might give everything its own sheet in the future. For that part, I used the following, gleaned from said old website:


Multiply hours by 15;

Divide minutes by 4;

Divide seconds by 239.999808000153;

Add it all together!


Leave the first number (degrees) as it is;

Divide minutes by 59.9999880000023;

Divide seconds by 3599.97120023039;

Add it all together.

  • 3
    $\begingroup$ Can I get actual analytic formula for conversion? $\endgroup$
    – Kyle
    Commented Apr 13, 2023 at 2:21
  • 1
    $\begingroup$ @Kyle You can, sorry. I'm new to this place. I'll edit it into the original answer. $\endgroup$
    – Kazon
    Commented Apr 15, 2023 at 16:28
  • 2
    $\begingroup$ @uhoh Sorry. I will do that ASAP! $\endgroup$
    – Kazon
    Commented Apr 15, 2023 at 16:28
  • 1
    $\begingroup$ Okay looks great, thanks! $\endgroup$
    – uhoh
    Commented Apr 15, 2023 at 19:29

You must log in to answer this question.

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