Guide Chinese Culture 8 min read

A Ziwei chart is four numbers and some arithmetic

The static chart is a function of the year stem, the lunar month, the lunar day and the birth hour. Locating the Life Palace, deriving the bureau and placing the emperor star are all arithmetic, and the leap month is where implementations genuinely disagree.

Eva Chin
Business & Chinese Culture Correspondent
Published 21 Sep 2026, 3:17 PM (SGT)
Share:
An open antique book beside a metal armillary sphere in low light An open antique book beside a metal armillary sphere in low light Photo by padrinan on Pixabay
Advertisement

A Ziwei Dou Shu chart looks elaborate: twelve palaces around a square, fourteen principal stars, a scatter of minor ones, each palace stamped with a stem and a branch. It reads like something that must require judgement to produce.

It does not. The static chart is a function of four numbers, and every step to the finished diagram is arithmetic you can do on paper. This article walks through that arithmetic for two examples to show how the chart is built. It makes no claim about what a chart means.

Four inputs, and nothing else

The construction uses four inputs: the heavenly stem of the lunar year, the lunar month, the lunar day, and the two-hour branch of birth.

What is absent is as telling as what is present. No solar terms. No latitude or longitude. No length of year. Sex does not enter the static chart at all — it only decides which way the decade cycles run later.

This system parts company from the more familiar four-pillars method on one point: the start of the year. Ziwei conventionally uses the lunar new year, not the solar term in early February. A chart for a birth between those two dates will have a different year stem depending on the convention — and the year stem drives the rest of the chart.

Locating the Life Palace

The traditional instruction is to start at the branch 寅, count forward to the birth month, then count backward to the birth hour. Numbering the branches 子 = 0 through 亥 = 11, so that 寅 = 2:

Life Palace = (2 + (month − 1) − hour) mod 12
Body Palace = (2 + (month − 1) + hour) mod 12

The origin is 寅 because the first lunar month is conventionally the 寅 month. Counting forward from there lands on the month; treating that palace as the first hour and counting back lands on the Life Palace. Count forward instead and you get the Body Palace, which overlays one of the twelve rather than being a thirteenth.

The remaining eleven palaces follow in decreasing branch order from the Life Palace: siblings, spouse, children, wealth, health, travel, friends, career, property, fortune, parents.

A warning that costs implementers real time. Sources describe this sequence with words meaning forward and backward, and two reputable sources describe the identical assignment in opposite terms — because one means direction along the branches and the other means direction around the drawn square. Implement from the arithmetic, never from the word.

Stamping the palaces with stems

Each palace takes a heavenly stem, assigned from the year stem by a rule shared with four-pillars practice. The year stem fixes the stem of the 寅 palace, and the rest advance with the branches:

Year stemStem of the 寅 palace
甲, 己
乙, 庚
丙, 辛
丁, 壬
戊, 癸

This is the step that makes the year matter. The Life Palace was located from month, day and hour alone — but its stem comes from here, and the next step reads that stem.

The bureau, from the Life Palace's own pillar

The five elements bureau is the sound-element of the Life Palace's stem-and-branch pair — not the year's. There is a shortcut, and it reproduces the classical sixty-pair table exactly:

stem   甲乙 = 1   丙丁 = 2   戊己 = 3   庚辛 = 4   壬癸 = 5
branch 子午丑未 = 1   寅申卯酉 = 2   辰戌巳亥 = 3
sum them; if the total exceeds 5, subtract 5
1 → wood   2 → metal   3 → water   4 → fire   5 → earth

Each element carries a number: water 2, wood 3, metal 4, earth 5, fire 6. That number does two jobs — it sets the age at which the first decade begins, and it is the divisor in the step that follows.

Placing the emperor star

This is the core arithmetic, and it is unusual enough to be worth stating plainly. Let n be the bureau number and d the lunar day.

  1. Find the smallest whole number q such that n × q is at least d.
  2. Let r = (n × q) − d. This is how much had to be borrowed to make the division come out even.
  3. Start at 寅 and advance q − 1 palaces.
  4. If r is even, advance a further r. If r is odd, retreat r.

The parity switch looks arbitrary but is not negotiable; it reproduces the memorised first-day row that practitioners learn by heart.

The companion star sits opposite, reflected about the 寅–申 axis:

天府 = (4 − 紫微) mod 12

So 寅 and 申 are fixed points: a chart with the emperor in 寅 has its companion in 寅 too. The pairs are 丑–卯, 辰–子, 巳–亥, 午–戌, 未–酉.

Advertisement

That axis is easy to get wrong. Mis-remember it as 巳–亥 and the two versions agree for births landing on 巳 or 亥 and disagree everywhere else — which is exactly the kind of error that survives a spot check.

Once those two are placed, the remaining twelve principal stars are pure offsets from one or the other. No further input is consulted.

Working one through

Take a birth at 16 August 2000, in the 寅 double-hour — lunar 庚辰 year, seventh month, seventeenth day. So the year stem is 庚, the month is 7, the day is 17, and the hour branch is 寅 = 2.

Life Palace: (2 + 6 − 2) mod 12 = 6 = 午. The long way: 寅 is month one, so 卯 辰 巳 午 未 申 is month seven; treating 申 as the 子 hour and counting back, 未 is 丑 and 午 is 寅.

Body Palace: (2 + 6 + 2) mod 12 = 10 = 戌.

Stems: year stem 庚 starts the 寅 palace at 戊, so 寅戊, 卯己, 辰庚, 巳辛, 午壬.

Bureau: the Life Palace is 壬午. 壬 scores 5, 午 scores 1, total 6, subtract 5 leaves 1 — wood. Wood three, so n = 3, and the first decade starts at age three.

Emperor: 3 × 5 = 15, short of 17. 3 × 6 = 18, which clears it, so q = 6 and r = 1. Advance five from 寅 — 卯 辰 巳 午 未 — landing on 未. One is odd, so retreat one: . The emperor star falls in the Life Palace.

Companion: (4 − 6) mod 12 = 10 = , which is one of the named pairs.

Checking it against something that does not show its working

Reproducing a chart that a calculator also produces proves only that two programs agree. The stronger test is a published worked example that states its answer without showing the arithmetic.

A Taiwanese teaching site gives, for a birth on the twenty-third day of the fifth lunar month of 1976 in the 卯 hour, a result of wood three with the emperor star in 申 — and no derivation.

Running the rules cold: the Life Palace is (2 + 4 − 3) mod 12 = 3 = 卯. The year 丙辰 starts the 寅 palace at 庚, so 卯 takes 辛, giving 辛卯. Scoring that, 辛 is 4 and 卯 is 2, total 6, minus 5 leaves 1 — wood three again. Then 3 × 7 = 21, short of 23; 3 × 8 = 24, so q = 8 and r = 1. Advance seven from 寅 to 酉, retreat one for the odd remainder, and the emperor lands in .

Both figures match a result the source did not derive. That is the test worth running.

Where two honest implementations disagree

The arithmetic above is common ground. Three input conventions are not, and each one can change the chart rather than relabel it.

The leap month. A leap month has no number of its own, leaving the month input undefined. Three conventions are in use. An implementation might treat the leap month as the month it repeats, as the following month, or split it, with days 1–15 belonging to the current month and the rest to the next. The split rule is what most software ships. For a birth in the second half of a leap month, the conventions produce different Life Palaces and different bureaus, which means a different emperor placement and a different chart. Practitioners deal with this by casting both and choosing against known history, which is a candid admission that the rules do not determine the answer.

The year boundary. Lunar new year is the mainstream convention, and the reference implementation we checked against defaults to it. A minority practice uses the February solar term instead. We could not read the source that argues for it, so we record it as a live minority position rather than dismissing it.

The day boundary. Whether the hour from eleven at night belongs to the current day or the next shifts the day input by one — which, in the emperor-star step, moves the star.

What was verified, and how

The rules here were implemented independently and checked against two birth moments. The first was a reference chart from an open-source implementation; the second was from a teaching site that states its result without derivation. Both reproduced exactly — the Life and Body palaces, the palace stems, the bureau and both star placements. The bureau shortcut was separately spot-checked against five pairs of the classical sixty-pair table and matched on all five. Read and run on 20 September 2026.

Two things are asserted by the sources and derived by none of them. Why the bureau numbers run two, three, four, five, six is explained by pointing at an older numerological sequence, and no source read for this article derives it — so it is repeated here as a convention, not a reason. And the precise tables governing the four transformations differ between schools on three of the ten stems, with the disagreements turning on doctrinal arguments about which stars may take which transformation. Those are outside the static construction described here.

Advertisement
Eva Chin
Business & Chinese Culture Correspondent

Eva Chin covers business and commerce in Southeast Asia for RECATOOLS, alongside Chinese cultural practice and education.

View author profile → · Editorial policy

Corrections policy

Advertisement