How Our BaZi Calculator Works
ON THIS PAGE
Our promise
Our BaZi calculator uses deterministic calendar calculations: solar terms, stem-branch cycles, and time corrections. Charts are never generated by an AI model, and no probability distribution stands between your birth details and the pillars you see.
AI writes interpretations only. It receives a finished chart as read-only data, and it may never alter, re-derive, or "correct" a single ganzhi. The calculation and the reading are two separate systems with a wall between them.
The calculation pipeline
1 · Input date · time · city
We accept a Gregorian or lunar calendar date (lunar dates are converted to Gregorian, leap months fully supported), a clock time to the minute, and a birth city with coordinates and an IANA timezone. Unknown birth times are supported — the chart is plotted with a clearly marked approximate hour pillar.
2 · Timezone & DST IANA tz database
Clock time is resolved against the full IANA historical offset table — not today's offset, but the offset in force on the day and hour you were born. Daylight-saving transitions, wartime offsets, and zone redefinitions are all applied.
China observed daylight saving in 1986–1991 (clocks +1h during the summer season, with switch dates varying by year). The calculator applies the historical offset for the date you enter.
3 · True solar time longitude + equation of time
BaZi hours follow the sun, not the timezone meridian. We correct standard time to apparent solar time at the birth location:
Worked examples calculated by the current solar-time engine (displayed to the minute):
| Input | Correction | Result (TST) |
|---|---|---|
| 1990-05-17 14:32 · Beijing (116.4°E, DST UTC+9) | DST −60 min · longitude −14.4 min · EoT +3.7 min | 13:21 |
| 1988-07-26 13:15 · Beijing (116.4°E, DST UTC+9) | DST −60 min · longitude −14.4 min · EoT −6.2 min | 11:54 |
| 1979-11-03 22:05 · London (0.1°W, UTC+0) | longitude −0.4 min · EoT +16.3 min | 22:20 |
4 · Pillar boundaries solar terms to the minute
The year pillar starts at Li Chun 立春 (Feb 3–5), not January 1st and not Chinese New Year. Month pillars begin at the twelve 节 solar terms. Term transitions are computed to the minute; a birth inside the transition minute is assigned by the exact instant.
5 · The hour branch & zi-hour 晚子时
This calculator uses the late-Zi convention: at 23:00 true solar time, the day pillar advances to the next day. For example, 23:40 true solar time on May 17 uses the day pillar of May 18. Other BaZi schools use a midnight boundary, so compare conventions when checking another calculator.
6 · Luck pillars 大运
Direction comes from the year-stem polarity crossed with gender. The start age is derived from the exact time distance to the adjacent solar term (3 days = 1 year), so each luck pillar's start is precise to the month, not rounded to the decade.
How we verify
The chart regression suite contains 15 locked birth examples covering historical daylight saving, different timezones, late-Zi crossings, and unknown-time mode. It compares calculated results with the saved expectations, checks calendar-frame rules against lunar-javascript, and checks three published day-pillar anchor dates. The fixture generator shares the calendar library used by the calculator; this is regression coverage, not an independent astronomical certification. Chart tests run in the deployment workflow and a failed check blocks that workflow.
| Fixture category | Coverage | Status |
|---|---|---|
| Locked birth-chart examples | 15 | Regression tested |
| Published day-pillar anchors | 1900-01-01, 1949-10-01, 2000-01-01 | Regression tested |
| China DST summer/winter offsets | 1986–1991 and abolition in 1992 | Regression tested |
| Lunar conversion | Leap months, invalid dates, and round-trip conversion | Regression tested |
How I Ching coin casting works
The I Ching online tool simulates three independent coin tosses per line. In this interface heads count as 2 and tails as 3. Adding the three values produces one of four line types, with eight equally likely combinations:
| Value | Line | Probability |
|---|---|---|
| 6 | Old yin · changing | 1/8 |
| 7 | Young yang · stable | 3/8 |
| 8 | Young yin · stable | 3/8 |
| 9 | Old yang · changing | 1/8 |
Six lines are read from the bottom upward and mapped to the King Wen hexagram sequence. Old yin (6) changes to yang; old yang (9) changes to yin. Flipping those changing lines gives the transformed hexagram. Manual entry uses the same mapping. Casting and the classic texts work locally; choosing an AI reading sends the cast and any question entered to our reading service and AI provider. Shared cast links contain the lines, not the question.
How the Chinese zodiac compatibility score works
The Chinese zodiac compatibility calculator uses birth-year branches and stem elements. This date-only tool approximates Li Chun with a fixed February 4 cutoff: January 1 through February 3 uses the previous year. It does not calculate the exact solar-term instant and differs from Lunar New Year zodiac guides. For February 3–5 births, enter your time and city in the BaZi calculator to check the astronomical year boundary. The relation between the two animals selects a starting band:
| Relation | Starting band |
|---|---|
| Six harmonies | 88–96 |
| Three harmonies (trines) | 82–92 |
| Same sign | 62–76 |
| Neutral | 56–72 |
| Self punishment | 40–55 |
| Harm | 40–54 |
| Punishment | 36–52 |
| Clash | 30–46 |
A deterministic birth-year adjustment chooses a value within that band. The birth-year stem elements then add 3 for the same element, add 6 for a generating relationship, or subtract 6 for a controlling relationship. The final displayed score is limited to 28–97. When relations overlap, the tool chooses a primary relation and may show an additional note.
These score bands are HeavenStem's illustrative presentation of traditional relations, not a measured probability of relationship success. They do not include Day Masters, month or hour pillars, or the experiences of the two people. Use the score for reflection; use the BaZi calculator to explore a full Four Pillars chart.
What the AI does — and may never do
Interpretations are the only AI-generated text on HeavenStem. The model receives the computed chart as read-only JSON and writes prose about it; it has no path back to the calculation.
- Paid report chapters are checked for chart consistency and required structure. Failed checks can trigger regeneration before a report is marked ready.
- A phrase filter checks generated text for configured medical, financial, and deterministic outcome language. It reduces specific errors; it cannot certify every interpretation.
- If an optional free AI reading is unavailable, the free tools can show a local template interpretation.
- Paid reports follow a generation and verification workflow. If delivery fails, the account page shows the status and available recovery steps.
Sources
Classical framework: Zǐpíng Zhēnquán 子平真诠 and the standard zi-ping lineage. Civil time: the IANA time zone database. Calendar conversion and solar-term ephemeris: open-source library lunar-javascript. The I Ching tool uses English text adapted from James Legge's 1882 translation of the Yi King.
Corrections
Found a chart you believe is wrong? That's a P0 bug to us. Write to hello@heavenstem.com with the birth details you entered, the pillar you expected, and what the chart showed. These details help us reproduce the calculation and add a regression case when a correction is needed.
Ready to see the pipeline run on your own details? Plot a chart free → Related documents: Privacy Policy · Terms & Disclaimers.