Ziwei Brief

Zi Wei Dou Shu · the calculation, in order

Zi Wei Dou Shu calculator: from birth time to twelve palaces

A calculator answers in a second and shows nothing about the answer. This page is the other half of ours: the eight steps the engine runs between the birth form and the finished chart, in the order it runs them, with the values it actually produced on one worked chart. If you want the chart, the tool is one click away. If you want to know why a chart looks the way it does, this is the order in which to read it.

Open the free calculator

Free, and no signup, card or email: it returns all twelve palaces with the fourteen main stars, and a printed score for each palace.

The worked chart is a made-up birth record — 15 June 1990, 14:00, London — used in every step below so that each claim can be checked against the same chart. Step 7 is where that record earns its keep: the engine does not read its 14:00 as 14:00.

For entertainment and self-reflection. Not medical, legal, financial, or psychological advice. We do not predict the future; you decide.

Step 1 · The clock time becomes one of twelve branches

A birth time is not used as a time. It is used as a position in a two-hour cycle, because the chart is built on twelve double-hours. The engine reduces HH:MM to an index between 0 and 11 with one line of arithmetic — add an hour, divide by two, take the remainder on division by twelve — and every later step consumes that index, never the clock reading.

The twelve hour branches and the clock window each one covers.
Hour branchClock window
子23:00–00:59
丑01:00–02:59
寅03:00–04:59
卯05:00–06:59
辰07:00–08:59
巳09:00–10:59
午11:00–12:59
未13:00–14:59
申15:00–16:59
酉17:00–18:59
戌19:00–20:59
亥21:00–22:59

子 is the only branch that straddles midnight: 23:00 and 00:30 share an index, and a birth at 23:xx keeps the calendar date you entered rather than rolling into the next day — the engine never sends the library a late-子 index, so there is no second convention hidden in the code. And a two-hour window is deliberately coarse: 13:59 and 14:01 are the same branch, so the chart cannot distinguish them and a reading should not pretend to.

Dates arrive either way. A solar date is converted to lunar before anything is placed; a lunar date is converted to solar first, then read back. Both entries end at the same lunar month and day, which is what step 2 needs.

Step 2 · Month and hour place the Life Palace

The Life Palace is one branch out of twelve, found from two inputs and nothing else: the lunar month and the hour branch. Count 寅 as the first month, run forward to the birth month, then count backwards by the hour branch. What you land on is the Life Palace.

Two things the rule hides. The month counted is the lunar month, and a leap month is split rather than doubled: its first half is counted as the month it repeats and its second half as the month after, because the library is called with leap-month fixing switched on. And the hour is counted backwards, which is why two births an hour apart in the same month land in adjacent branches instead of the same one.

The same two inputs, counted forward instead of backward, place the Body Palace. It is a marker on one of the twelve, not a thirteenth palace: on the worked chart it lands on 子, the same branch as the Life Palace, which is an ordinary outcome and not a fault.

Once the Life Palace is fixed, the other eleven names follow in their fixed order, stepping backwards through the branches — Siblings, Spouse, Children, Wealth, Vitality, Travel, Friends, Career, Property, Inner Life, Parents. Names run one way and branches the other, so the branch six seats from the Life Palace is always Travel; that is why an empty Life Palace reads through Travel rather than through whichever palace happens to sit next door. Each of the twelve has its own page — the palace index is the way in.

Worked chart: Life Palace 子, Body Palace 子.

Step 3 · The Life Palace gets a stem, and the pair names a bureau

The Life Palace has a stem as well as a branch, and it is not the birth-year stem. A fixed table gives 寅 its stem from the year stem — 甲 and 己 years open 寅 on 丙, 乙 and 庚 on 戊, 丙 and 辛 on 庚, 丁 and 壬 on 壬, 戊 and 癸 on 甲 — and the palace stems advance from there by one stem per branch. Count from 寅 to the Life Palace's branch and you have its stem.

Stem and branch together name one of five bureaux, by the old counting: stems score one to five in pairs (甲乙 1, 丙丁 2, 戊己 3, 庚辛 4, 壬癸 5), branches score one to three (子午丑未 1, 寅申卯酉 2, 辰巳戌亥 3). Add the two scores, subtract five while the total is above five, and the remainder picks the bureau: 木三局, 金四局, 水二局, 火六局, 土五局. The digit inside the name is the whole point — it is the divisor used in step 4, and it is the only thing the rest of the chart takes from the bureau.

Worked chart: the year stem is 庚, so 寅 opens on 戊; the Life Palace is 10 seats forward from 寅, and advancing the stem of 寅 by the same 10 places gives 戊 — the pair 戊子. The stem scores 3, the branch scores 1, the sum is 4: the bureau is 火六局. That is the string the engine returned for this chart, not a reconstruction.

Step 4 · Where Zi Wei lands, and the thirteen that follow

Zi Wei is not placed by addition. It is placed by division with a remainder, and the rule is worth following once because it explains why two charts a day apart can look unrelated.

Take the lunar day. Find the smallest offset that makes the day plus the offset divisible by the bureau number. Divide. Subtract one from the quotient. If the offset is even, add it; if it is odd, subtract it; wrap the result into twelve seats counted from 寅. That seat is where Zi Wei sits. Tian Fu is its mirror: twelve minus that seat, wrapped.

Worked chart: the lunar day is 23 and the bureau is 火六局, so the first offset that divides is 1; 23 plus 1 is 24, and 24 divided by 6 is 4. One less is 3; the odd offset of 1 takes it back, so Zi Wei sits 2 seats from 寅 — 辰, which is the branch the engine gave it. Tian Fu takes the mirror seat, 子.

The other thirteen follow from those two anchors by fixed steps, with deliberate gaps. The Zi Wei group runs backwards: Tian Ji one seat back, Tai Yang three, Wu Qu four, Tian Tong five, Lian Zhen eight. The Tian Fu group runs forwards: Tai Yin one on, Tan Lang two, Ju Men three, Tian Xiang four, Tian Liang five, Qi Sha six, Po Jun ten. The gaps are why a palace holds one main star, two, or none at all, and they are fixed — nothing in the layout is adjusted afterwards to balance the chart. Every one of the fourteen has a page of its own — the star index is the way in.

Step 5 · The four transformations come from the year stem

One more table reads only the birth-year stem and marks four stars: one Lu, one Quan, one Ke, one Ji. These are the birth-year transformations, and they travel with the star wherever it sits — a star does not stop carrying Ji because it landed in a quiet palace.

The four birth-year transformations for each of the ten heavenly stems.
Year stemLuQuanKeJi
甲Lian ZhenPo JunWu QuTai Yang
乙Tian JiTian LiangZi WeiTai Yin
丙Tian TongTian JiWen Chang · supportLian Zhen
丁Tai YinTian TongTian JiJu Men
戊Tan LangTai YinYou Bi · supportTian Ji
己Wu QuTan LangTian LiangWen Qu · support
庚Tai YangWu QuTai YinTian Tong
辛Ju MenTai YangWen Qu · supportWen Chang · support
壬Tian LiangZi WeiZuo Fu · supportWu Qu
癸Po JunJu MenTai YinTan Lang

Some of the marked stars are not among the fourteen. In 5 of the ten stems at least one of the four lands on a support star: 丙 on Wen Chang (Ke), 戊 on You Bi (Ke), 己 on Wen Qu (Ji), 辛 on Wen Qu (Ke), 辛 on Wen Chang (Ji), 壬 on Zuo Fu (Ke). The engine reads the transformation off whatever star carries it, so those count in full, and the transformation is scored the same wherever it falls; the star underneath adds its own separate term.

Worked chart: the year stem is 庚, and the four land on Tai Yang (Lu), Wu Qu (Quan), Tai Yin (Ke) and Tian Tong (Ji) — exactly the row the table gives for 庚.

Step 6 · Brightness: seven words, three buckets

Every main star carries a twelve-entry brightness table, one entry per branch, so brightness belongs to the star and to where it sits, not to the star alone. The vocabulary is seven words: 庙 旺 得 利 平 不 陷. Zi Wei is 庙 in 午 and 平 in 子 — the same star, the same chart, a different branch.

The engine does not read seven levels. It collapses them to three — 庙 旺 得 become bright, 利 平 become neutral, 不 陷 become dim — and a star the source leaves unmarked gets a case of its own rather than being treated as neutral. The three-level version is what the score sees; the seven-word version is what the chart shows.

The fourteen main stars on the worked chart: branch, seven-word level, three-level reading.
StarBranchLevelRead as
Zi Wei辰得bright
Tian Ji卯旺bright
Tai Yang丑不dim
Wu Qu子旺bright
Tian Tong亥庙bright
Lian Zhen申庙bright
Tian Fu子庙bright
Tai Yin丑庙bright
Tan Lang寅平neutral
Ju Men卯庙bright
Tian Xiang辰得bright
Tian Liang巳陷dim
Qi Sha午旺bright
Po Jun戌旺bright

The branch and the three-level reading are the chart's own; the seven-word level is the same lookup that produced them. Two stars in one branch can carry different levels, so the level is never a property of the palace.

Step 7 · The birthplace moves the clock before any of it runs

Every step above reads a clock, and a birth record does not give the position of the sun — it gives a clock reading in a place. The engine converts one to the other before step 1: four minutes per degree between the birthplace's longitude and the standard meridian of its time zone, plus the equation of time, rounded to the nearest minute.

The standard meridian is fifteen degrees for every hour of the UTC offset in force at that moment, read from the IANA zone with its historical daylight-saving rules. London in June is on UTC+1, so its meridian is 15°E, not 0°. Without a zone the engine falls back to the UTC+8 meridian it used for every birth before the site went overseas, and a London birth is then read against a meridian hours away from the right one — a different chart, not a rounding difference.

The second term is the equation of time: the sun runs ahead of or behind clock noon through the year, because Earth's orbit is elliptical and its axis is tilted. It is small next to a longitude error, and it is still applied — a correction that is skipped when it looks small is a correction nobody can audit.

The same clock time read with the birthplace time zone and with the UTC+8 fallback.
Birthplace and clockRead with its zoneRead with the UTC+8 fallback
London, 14:00−0.13°12:59 · Life Palace 子 · 火六局05:59 · Life Palace 卯 · 土五局
Beijing, 14:00116.4°12:45 · Life Palace 子 · 火六局13:45 · Life Palace 亥 · 土五局

Both rows run the same chart-building code; the only difference is whether a zone was passed with the birth record. The Beijing row is there because China's own daylight saving ran from 1986 to 1991 and the zone data knows it: with the zone the standard meridian moves a full hour east and the reading comes back an hour, which moves the Life Palace and the bureau with it. That is the old chart being corrected, not a regression — and it is why the correction runs before step 1 instead of being noted afterwards.

None of this is interpretation, and none of it is optional: it is a clock reading converted to the position of the sun over that longitude, and it can be checked against an almanac.

Step 8 · An empty palace borrows, and only the main stars

A palace can hold no main stars at all. When that happens nothing is missing from the chart and nothing is missing from the reading: the palace takes its main stars from the palace opposite — six seats away — and pays a fixed penalty for the loan.

What crosses over is narrow. Only the main stars are borrowed; the opposite palace's support and maleficent stars stay where they are and are not counted twice. The borrowed stars keep their own brightness and their own transformations, so a borrowed Ji still reads as Ji, and still carries the extra weight it carries in the Life, Wealth, Career or Spouse palace. The score marks the result as borrowed, so a reading from across the chart is never shown as a placement of its own.

How many palaces are empty follows from where Zi Wei sits; which ones follow from the whole chart. Neither is decided anywhere else in the pipeline — both are consequences of steps 2 to 4.

The score is a separate rule from the chart — a base, stated deltas, a clamp and four bands — and it has its own page: how a palace score is computed.

What this page does not claim

  • It does not claim the chart is accurate about a person. It claims the arithmetic is the arithmetic: the same birth data, run in the order above, produces the same chart every time.
  • It does not give an accuracy figure. There is nothing here to measure one against, and a calculator that quoted one would be inventing it.
  • It does not settle which classical variant is correct. The steps above are the ones this engine runs. Another implementation using a different table would produce a different chart from the same birth record, and neither would be lying about its own arithmetic.

Start here

Read next