How We Built a Fast, Mobile-Friendly Natal Chart Calculator on the Web
A natal chart is a snapshot of the sky at the exact moment and place someone was born. Turning that idea into a web tool that renders in under a second on a mid-range phone turned out to be a fun mix of astronomy, geometry and front-end performance work. Here's how we approached it for BanDoSao.me, a free natal chart calculator for Vietnamese users.
1. From birth data to Julian Day
Everything starts with converting local birth date and time into Universal Time, which means resolving the birthplace's coordinates and historical time zone offset (Vietnam alone changed its offset several times in the 20th century). We then convert UT into a Julian Day number, the continuous day count that ephemeris algorithms expect.
2. Planetary positions (ephemeris)
With the Julian Day, we compute ecliptic longitudes for the Sun, Moon and planets. High-precision ephemeris data is large, so we keep the heavy calculation off the main thread and return only what the chart needs: longitude, speed (to detect retrograde motion) and sign.
3. Houses and the Ascendant
The Ascendant and house cusps depend on local sidereal time and geographic latitude. We compute sidereal time from the Julian Day and longitude, then derive the Ascendant, Midheaven and the 12 house cusps. Edge cases matter: at high latitudes some house systems break down, so the code needs sensible fallbacks.
4. Aspects
Aspects are angular relationships between planets (conjunction 0°, sextile 60°, square 90°, trine 120°, opposition 180°). We compare every planet pair, normalize the angle to 0–180°, and check it against each aspect's orb.
5. Rendering the wheel with SVG
We chose SVG over Canvas because the chart is a mostly static vector drawing that must stay crisp at any zoom level, be styleable with CSS, and stay accessible. The wheel is built from concentric rings (zodiac, houses, planets) using polar-to-Cartesian conversion, rotated so the Ascendant sits on the left. Overlapping planet glyphs are spread apart with a simple collision pass.
6. Keeping it fast on mobile
No install, minimal JavaScript, lazy-loaded interpretation text, and a responsive viewBox so the chart scales cleanly from phones to desktops.
Happy to answer questions about the math or the SVG layout in the comments!