If you've ever put your birth details into a Western astrology app and an Indian one, you've probably seen them disagree. Your "Leo Sun" becomes a Cancer Sun, your Moon jumps back a sign. Neither app is broken. They're measuring from different starting points, and the difference fits in one function.
Two zodiacs, one sky
Both systems split the ecliptic into twelve 30° signs. They disagree on where 0° Aries is.
- Tropical (Western): 0° Aries is the March equinox point.
- Sidereal (Vedic/Jyotish): 0° Aries is fixed against the stars.
The equinox slowly slides backwards through the stars (precession, about 50.3″ a year), so the gap between the two grows over time. That gap is called the ayanamsa. In 2026 it's a little over 24°.
The code
India's standard is the Lahiri (Chitrapaksha) ayanamsa. A mean version is a short polynomial in Julian centuries since J2000:
// Julian centuries since 2000-01-01 12:00 TT (close enough for this purpose) const centuriesSinceJ2000 = (date) => (date.getTime() / 86400000 + 2440587.5 - 2451545.0) / 36525; // Mean Lahiri ayanamsa in degrees const lahiri = (T) => 23.857092 + (5028.796195 * T + 1.1054348 * T * T) / 3600; const SIGNS = ["Aries","Taurus","Gemini","Cancer","Leo","Virgo", "Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"]; function toSidereal(tropicalLongitude, date) { const lon = (tropicalLongitude - lahiri(centuriesSinceJ2000(date)) + 360) % 360; return { sign: SIGNS[Math.floor(lon / 30)], degree: +(lon % 30).toFixed(2) }; } // Sun at 5° tropical Taurus (35°) on 25 April 2026: console.log(toSidereal(35, new Date("2026-04-25T12:00:00Z"))); // -> { sign: "Aries", degree: 10.78 } Same Sun, same moment: Taurus in one app, Aries in the other.
Why it matters more for the Moon
The Sun moves about 1° a day, so for most people only the Sun sign shifts. The Moon moves about 13° a day, and Vedic astrology slices its path into 27 nakshatras of 13°20′ each. The Moon's nakshatra at birth sets the start of the Vimshottari dasha, the 120-year planetary-period timeline at the centre of Indian astrology. Get the ayanamsa wrong and you get the wrong nakshatra, and the whole timeline moves.
To do this properly you need an accurate Moon longitude first (Jean Meeus's Astronomical Algorithms, chapter 47, or the Swiss Ephemeris) and a correction for ΔT, the difference between clock time and the time scale planetary formulas use.
Try it
Paste the snippet into your browser console and feed it your own Sun longitude from any Western app. Then, if you want the full answer for your Moon, the free Moon sign and nakshatra calculator does the full calculation (Swiss Ephemeris, Lahiri) without storing anything you type.
Found an edge case or a better ayanamsa formula? Tell us in the comments.
We build Jyomance, a Vedic astrology AI that shows the classical rule behind every line of a reading.