How to Calculate a Zi Wei Dou Shu Chart: Step-by-Step Guide

Checked against iztro 2.5.8 · Reviewed

To calculate a Zi Wei Dou Shu chart, first convert the birth date to the Chinese lunar calendar, locate the Life and Body Palaces from the lunar month and birth hour, determine the Five Element Bureau, and place Zi Wei from the lunar day. The remaining principal stars follow two fixed sequences. The birth-year stem then determines the Four Transformations.

Zi Wei Dou Shu is also written Ziwei Doushu or ZWDS and is often called Purple Star Astrology in English. This guide explains the arithmetic behind the major-star framework used by our calculator, following iztro 2.5.8 with its default rules. The worked example includes every palace and all fourteen principal stars, so you can compare each stage with a generated chart.

Write down your calendar and time conventions before starting. A different leap-month, Zi-hour or year-boundary rule can produce a different chart from the same birth record. The calculation steps below keep those choices explicit.

1. Prepare the birth date and birth-hour branch

Begin with the recorded date and local clock time. If you enter a Gregorian date, the engine converts it to lunar year, lunar month, lunar day and leap-month status. If you enter a lunar date, include whether it is the regular month or its leap repetition; these are different calendar dates. A leap month does not mean a Gregorian leap year.

The principal-star calculation uses a two-hour birth period, called a shichen. Convert the chosen clock or solar time to an hour branch. For ordinary hours, h = floor((hour + 1) / 2). Thus 09:30 is Si, h = 5; 11:00 starts Wu, h = 6. Minutes matter when a solar-time correction moves the birth time across a period boundary.

For the formulas, the hour branch is numbered from Zi = 0 through Hai = 11. Both Zi periods have branch value zero. The library also has a separate late-Zi input index, 12, which activates its day convention; that index is not a thirteenth Earthly Branch.

Birth-hour branches, using local time before any optional solar correction
Clock intervalBranchHour-branch value h
23:00–01:00Zi (Rat)0; check the day convention
01:00–03:00Chou (Ox)1
03:00–05:00Yin (Tiger)2
05:00–07:00Mao (Rabbit)3
07:00–09:00Chen (Dragon)4
09:00–11:00Si (Snake)5
11:00–13:00Wu (Horse)6
13:00–15:00Wei (Goat)7
15:00–17:00Shen (Monkey)8
17:00–19:00You (Rooster)9
19:00–21:00Xu (Dog)10
21:00–23:00Hai (Pig)11

References: iztro official quick start: solar and lunar chart inputs · iztro 2.5.8: branch order, palace order, time ranges and Five Tigers rule · iztro 2.5.8: index wrapping and leap-month adjustment

2. Number the twelve fixed chart positions

The Earthly Branches belong to fixed chart positions. Palace names move around that frame according to the birth month and hour. Use the following indices throughout: Yin is zero, not Zi. This matches the palace array returned by iztro.

A positive step follows the branch order in the table; a negative step goes backward. Define mod12(x) as the remainder wrapped into 0–11: mod12(−1) = 11 and mod12(13) = 1. Using indices avoids confusion when a diagram is drawn in a different orientation.

mod12(x) = ((x % 12) + 12) % 12
The fixed branch frame used in this guide and its example diagram
IndexBranchIndexBranch
0Yin (Tiger)6Shen (Monkey)
1Mao (Rabbit)7You (Rooster)
2Chen (Dragon)8Xu (Dog)
3Si (Snake)9Hai (Pig)
4Wu (Horse)10Zi (Rat)
5Wei (Goat)11Chou (Ox)

References: iztro official documentation: palaces · iztro 2.5.8: index wrapping and leap-month adjustment

3. Calculate the Life Palace and Body Palace

Let M be the lunar month used for placement after the leap-month rule has been applied. Begin with month one at Yin and move M − 1 positions forward. From that position, move h positions backward for the Life Palace, or h positions forward for the Body Palace.

Count the starting position as Zi hour, with zero moves. Likewise, lunar month one requires zero moves from Yin. These two starting values prevent the most common one-palace error in a manual calculation.

The Body Palace is a marker on an existing palace. Since its offset from the Life Palace is 2h, it can fall in Life, Fortune, Career, Travel, Wealth or Spouse. It does not add a thirteenth box.

Life Palace index L = mod12((M − 1) − h)
Body Palace index = mod12((M − 1) + h)

References: iztro 2.5.8: Life and Body, Bureau and ten-year calculations · iztro 2.5.8: branch order, palace order, time ranges and Five Tigers rule

4. Assign the palace names and Heavenly Stems

Place Life at index L. The palace-name sequence below proceeds in the positive branch direction. Equivalently, the familiar sequence Life, Siblings, Spouse, Children and so on goes backward from Life.

Next determine the stem at Yin from the birth-year stem, using the Five Tigers rule. Starting at Yin, advance one Heavenly Stem per branch position. The ten-stem sequence is Jia, Yi, Bing, Ding, Wu, Ji, Geng, Xin, Ren, Gui; it repeats while the twelve branch positions continue. Number those stems 0–9 and use mod10 to wrap into that range, just as mod12 wraps the branches.

For example, a Geng birth year starts Yin with Wu. Position 11, Chou, is eleven steps later: Wu → Ji after wrapping through the ten stems. The Life Palace at Chou therefore has Ji as its stem. Keep the stem and branch together; that pair is needed for the next calculation.

Palace-name sequence index at position p = mod12(p − L)
Palace stem index at position p = mod10(Yin starting-stem index + p)
Palace names in the positive branch direction from Life
Offset from LifePalaceOffset from LifePalace
0Life (Ming)6Travel (Qian Yi)
1Parents (Fu Mu)7Health (Ji E)
2Fortune (Fu De)8Wealth (Cai Bo)
3Property (Tian Zhai)9Children (Zi Nu)
4Career (Guan Lu)10Spouse (Fu Qi)
5Friends (Pu Yi)11Siblings (Xiong Di)
Five Tigers rule: the birth-year stem determines the stem at Yin
Birth-year stemsStem at Yin
Jia or JiBing
Yi or GengWu
Bing or XinGeng
Ding or RenRen
Wu or GuiJia

References: iztro 2.5.8: branch order, palace order, time ranges and Five Tigers rule · iztro 2.5.8: Life and Body, Bureau and ten-year calculations

5. Determine the Five Element Bureau

The Five Element Bureau, also called the Five Element Class or ju, comes from the Life Palace stem–branch pair. It is not obtained by looking up the ordinary element of the birth-year stem. The engine implements the following numerical shortcut for the pair’s Na Yin element.

Add the stem lookup value to the branch lookup value. If the sum exceeds five, subtract five. Match that result to an element, then use the corresponding Bureau number B. The lookup result and B are different numbers: a result of four means Fire, whose Bureau number is six.

For Ji–Chou, Ji has value 3 and Chou has value 1. The sum is 4, so the chart is Fire Six. This B = 6 becomes the divisor when locating Zi Wei and the starting nominal age of the first ten-year period.

Stem lookup values
Life Palace stemValue
Jia, Yi1
Bing, Ding2
Wu, Ji3
Geng, Xin4
Ren, Gui5
Branch lookup values
Life Palace branchValue
Zi, Chou, Wu, Wei1
Yin, Mao, Shen, You2
Chen, Si, Xu, Hai3
Convert the reduced sum to the Bureau number
Reduced sumElementBureau number B
1Wood3
2Metal4
3Water2
4Fire6
5Earth5

References: iztro 2.5.8: Life and Body, Bureau and ten-year calculations · iztro 2.5.8: branch order, palace order, time ranges and Five Tigers rule

6. Calculate Zi Wei and Tian Fu placement

Use the lunar birth day D after the chosen Zi-hour day treatment. Find the smallest nonnegative number r that makes D + r divisible by B. Divide to obtain q. Count q − 1 positions forward from Yin, then apply the padding adjustment: move forward by r if r is even, or backward by r if r is odd.

This rule also handles a birth day smaller than B. For instance, day one with Water Two needs r = 1 and q = 1. The starting index is zero, then one backward step gives index 11, Chou. When the day divides evenly, r = 0 and no extra shift is needed.

Tian Fu is obtained by reflecting the Zi Wei index with the formula below. This is not the same operation as moving six palaces to the opposite box. In the worked example, Zi Wei at Chen, index 2, gives Tian Fu at Zi, index 10. At indices 0 and 6, the two seed stars share a position.

  1. Choose the smallest r from 0 through B − 1 such that (D + r) is divisible by B.
  2. Calculate q = (D + r) / B.
  3. Start at index q − 1. Add r when r is even; subtract r when r is odd.
  4. Wrap the result into 0–11 to get Zi Wei index Z.
  5. Calculate Tian Fu index F = mod12(−Z).
r = (B − (D % B)) % B
q = (D + r) / B
Z = mod12(q − 1 + (r is even ? r : −r))
F = mod12(−Z)

References: iztro 2.5.8: Zi Wei, Tian Fu and auxiliary-star locations

7. Place all fourteen principal stars

The remaining principal stars are fixed offsets from Zi Wei or Tian Fu. For each row, add the offset to its seed index and wrap with mod12. Two stars can occupy one palace; some palaces contain no principal star.

Keep the gaps in each sequence. Tian Ji is one position backward from Zi Wei, but Tai Yang is three backward, not two. Po Jun is ten forward from Tian Fu, not immediately after Qi Sha. An omitted gap shifts several stars while leaving the seed positions correct.

An empty principal-star palace still has its own stem, branch and name, and may contain auxiliary stars. Do not fill it by moving a principal star from another box. Consulting the opposite palace is a later interpretation technique, not a change to the calculated placements.

Principal-star offsets in the Yin-based branch frame
Seed groupStarOffset from seed
Zi WeiZi Wei0
Zi WeiTian Ji−1
Zi WeiTai Yang−3
Zi WeiWu Qu−4
Zi WeiTian Tong−5
Zi WeiLian Zhen−8
Tian FuTian Fu0
Tian FuTai Yin+1
Tian FuTan Lang+2
Tian FuJu Men+3
Tian FuTian Xiang+4
Tian FuTian Liang+5
Tian FuQi Sha+6
Tian FuPo Jun+10

References: iztro 2.5.8: the two principal-star sequences

8. Add auxiliary stars and the Four Transformations

The Four Transformations, or Si Hua, attach labels to stars already placed in the chart. The birth-year stem selects four stars in the order Hua Lu, Hua Quan, Hua Ke and Hua Ji. Their traditional themes are resources, authority, recognition and friction; the labels do not move the stars to new palaces.

Some rows involve auxiliary stars. Four useful placements, in the same index system, are Zuo Fu = mod12(2 + M − 1), You Bi = mod12(8 − (M − 1)), Wen Chang = mod12(8 − h), and Wen Qu = mod12(2 + h). The calculator adds further auxiliary and miscellaneous stars with their own year, month, day or hour rules.

For a Geng birth year, the natal labels are Tai Yang–Lu, Wu Qu–Quan, Tai Yin–Ke and Tian Tong–Ji. In the example, Tai Yang and Tai Yin are both in Life, Wu Qu is in Siblings, and Tian Tong is in Spouse. Two different transformations can therefore appear in the same palace.

Palace-stem flying transformations use the same table, but start from each palace’s own stem. Record which stem generated a transformation: a natal year-stem label and a palace-stem flight are separate layers. Schools can use different transformation tables; the table below matches this calculator.

The ten-stem Four Transformations table used by the calculator
StemHua LuHua QuanHua KeHua Ji
JiaLian ZhenPo JunWu QuTai Yang
YiTian JiTian LiangZi WeiTai Yin
BingTian TongTian JiWen ChangLian Zhen
DingTai YinTian TongTian JiJu Men
WuTan LangTai YinYou BiTian Ji
JiWu QuTan LangTian LiangWen Qu
GengTai YangWu QuTai YinTian Tong
XinJu MenTai YangWen QuWen Chang
RenTian LiangZi WeiZuo FuWu Qu
GuiPo JunJu MenTai YinTan Lang

References: iztro 2.5.8: the ten-stem Four Transformations table · iztro 2.5.8: Zi Wei, Tian Fu and auxiliary-star locations · iztro 2.5.8: auxiliary-star placement and transformations

9. Check leap months, Zi hour and true solar time

Compare conventions before concluding that two calculators disagree about arithmetic. The current engine takes the natal year boundary at lunar New Year, not automatically at Li Chun, the Beginning of Spring solar term. Births between those boundaries may receive different year stems when another school uses Li Chun.

For an adjusted leap month, days 1–15 retain its numbered month and later days use the next month for placement. The installed engine has a specific exception: late-Zi input index 12 does not apply that extra month increment. The solar-date entry uses leap adjustment; lunar-date entry also lets you choose the whole numbered month. The day number is still used separately for Zi Wei placement.

For Zi hour, this site offers two treatments for times from 23:00 to 00:59. The current-day option sends index 0; the next-day option sends index 12. With the engine’s forward day rule, index 12 adds one to the lunar day for Zi Wei placement, wrapping to day one if it exceeds that lunar month’s length. It does not simply replace every input with the next Gregorian date. Check the selected treatment when comparing midnight births.

True solar time adds a longitude correction and the equation of time to clock time. With east longitude positive and UTC offset H in hours, the correction in minutes is approximately 4 × longitude − 60 × H + E, where E is the equation of time. For UTC+8, a birthplace at 116°E contributes −16 minutes from longitude alone; E must still be added.

Our optional solar correction uses the birthplace’s date-based timezone offset, including daylight-saving information, and an approximate equation of time. It changes the hour used for chart placement. The current implementation retains the entered calendar date when corrected time wraps across midnight, so check the intended date separately in that case. A historic daylight-saving transition also warrants checking the original time record. Leave solar correction off to reproduce the fictional example below.

Settings to record when comparing charts
ChoiceEffect on calculation
Gregorian or lunar dateMust identify the same calendar date, including any leap-month flag.
Leap-month placementCan change M, then Life, Body, palace names and the Bureau.
Lunar New Year or Li Chun boundaryCan change the birth-year stem and year-based placements.
Current-day or next-day Zi treatmentCan change the day used to locate Zi Wei.
Clock time or true solar timeCan change h when the corrected time crosses a two-hour boundary.
School or custom transformation tableCan change transformation labels even if the stars match.

References: iztro 2.5.8: index wrapping and leap-month adjustment · iztro 2.5.8: Zi Wei, Tian Fu and auxiliary-star locations · iztro 2.5.8: chart configuration and entry points · NOAA: General Solar Position Calculations

10. Verify the chart before adding timing layers

Compare intermediate values in order: lunar date and hour branch; Life and Body indices; Life stem–branch pair; Bureau number; Zi Wei and Tian Fu indices; the fourteen placements; then natal transformations. The first mismatch usually identifies the convention or counting step that needs checking.

There should be twelve fixed branch positions, one Life Palace, one Body marker and fourteen principal-star entries across the chart. Multiple entries in one palace are expected. Auxiliary stars such as Lu Cun and Tian Ma should not be counted among the fourteen principal stars, even if a chart display groups them near the main stars.

A full calculator output adds brightness labels, auxiliary stars, twelve-star cycles and timing layers. For the first ten-year period, the Bureau number sets its nominal age range: Fire Six starts at ages 6–15. In the default rules, a yang-year male or yin-year female proceeds forward from Life; a yin-year male or yang-year female proceeds backward. These are traditional nominal ages, so do not read them as exact birthday-based Western ages.

Once the placements match, use the chart to study palace relationships. In this index system, the two trine positions are p − 4 and p + 4, and the opposite position is p + 6, all wrapped with mod12. These relationships describe the calculated frame; interpreting their meaning is a separate stage.

References: iztro 2.5.8: Life and Body, Bureau and ten-year calculations · iztro 2.5.8: branch order, palace order, time ranges and Five Tigers rule · iztro 2.5.8: chart configuration and entry points

Worked example: a fictional birth checked against iztro

This is a fictional example for learning the calculation. Use Gregorian 15 June 1990 at 09:30, male, with true solar time off and the default engine rules. The birth time is comfortably inside Si hour and the lunar month is not a leap month.

The installed iztro 2.5.8 engine converts the date to lunar year 1990, month 5, day 23. Its four-pillar output is Geng–Wu, Ren–Wu, Xin–Hai, Gui–Si. Only the year stem, lunar month and day, and hour branch are needed for the principal-star steps shown here.

The diagram and table show the fourteen principal stars only. Empty rows mean no principal star, not a completely empty chart palace. The Body marker is at Hai, in the Spouse Palace. The calculated natal Four Transformations are listed separately so each star keeps a clear placement.

Solar date
1990-06-15
Recorded clock time
09:30 local clock time
Traditional chart gender
Male
Birth-hour index
5
True solar time
Off
Leap-month adjustment
On; the example is not in a leap month
Zi-hour convention
Not applicable: the time is Si hour
  1. Calendar and hour: lunar month M = 5, day D = 23; Si hour gives h = 5.
  2. Month starting point: M − 1 = 4, the Wu branch position.
  3. Life: mod12(4 − 5) = 11, Chou. Body: mod12(4 + 5) = 9, Hai.
  4. Palace stems: Geng year starts Yin with Wu. Advancing eleven positions gives Ji at Chou, so the Life pair is Ji–Chou.
  5. Bureau: Ji contributes 3 and Chou contributes 1. Sum 4 corresponds to Fire Six, B = 6.
  6. Zi Wei: 23 needs r = 1 to reach 24; q = 24 / 6 = 4. The provisional index is q − 1 = 3. Since r is odd, subtract one: Z = 2, Chen.
  7. Tian Fu: F = mod12(−2) = 10, Zi.
  8. Examples of offsets: Tian Ji = mod12(2 − 1) = 1, Mao; Tai Yang = mod12(2 − 3) = 11, Chou; Po Jun = mod12(10 + 10) = 8, Xu.
  9. Geng-year natal transformations: Tai Yang–Lu in Life; Wu Qu–Quan in Siblings; Tai Yin–Ke in Life; Tian Tong–Ji in Spouse.
Worked Zi Wei Dou Shu chart for a fictional male born on 15 June 1990 at 09:30, showing twelve palaces, fourteen major stars and the Body Palace.
Fictional worked example. The diagram shows the fourteen major stars; the complete chart also contains auxiliary stars, brightness states and timing layers. View the full-size diagram
All twelve palaces in the worked example
Branch and stemPalaceMajor starsBody Palace
WuYinParentsTan Lang—
JiMaoFortuneTian Ji, Ju Men—
GengChenPropertyZi Wei, Tian Xiang—
XinSiCareerTian Liang—
RenWuFriendsQi Sha—
GuiWeiTravelNo major star—
JiaShenHealthLian Zhen—
YiYouWealthNo major star—
BingXuChildrenPo Jun—
DingHaiSpouseTian TongYes
WuZiSiblingsWu Qu, Tian Fu—
JiChouLifeTai Yang, Tai Yin—
Birth-year Four Transformations
StarTransformationBranchPalace
Tai YangHua LuChouLife
Wu QuHua QuanZiSiblings
Tai YinHua KeChouLife
Tian TongHua JiHaiSpouse

References: iztro official quick start: solar and lunar chart inputs · iztro 2.5.8: Life and Body, Bureau and ten-year calculations · iztro 2.5.8: Zi Wei, Tian Fu and auxiliary-star locations · iztro 2.5.8: the two principal-star sequences · iztro 2.5.8: the ten-stem Four Transformations table

Sources and calculation conventions

  1. iztro official quick start: solar and lunar chart inputs

    Documents bySolar and byLunar, the 0–12 time input, leap-month parameters and returned chart data.

  2. iztro official documentation: palaces

    Explains the twelve palace names and the fixed palace array starting at Yin, index zero.

  3. iztro 2.5.8: Life and Body, Bureau and ten-year calculations

    getSoulAndBody, getFiveElementsClass, getPalaceNames and getHoroscope are the primary calculation references.

  4. iztro 2.5.8: branch order, palace order, time ranges and Five Tigers rule

    Defines the stem and branch sequences, PALACES, TIME_RANGE, TIGER_RULE and numerical Bureau values.

  5. iztro 2.5.8: index wrapping and leap-month adjustment

    fixLunarMonthIndex includes the day-15 boundary and the timeIndex 12 exception; fixIndex wraps chart positions.

  6. iztro 2.5.8: Zi Wei, Tian Fu and auxiliary-star locations

    getStartIndex implements the padding-and-parity calculation; getZuoYouIndex and getChangQuIndex locate four auxiliary stars.

  7. iztro 2.5.8: the two principal-star sequences

    getMajorStar sets the six Zi Wei-group and eight Tian Fu-group offsets, including their gaps.

  8. iztro 2.5.8: auxiliary-star placement and transformations

    Places the auxiliary stars and applies year-stem transformation labels to eligible auxiliary stars.

  9. iztro 2.5.8: the ten-stem Four Transformations table

    Each mutagen array is ordered Lu, Quan, Ke, Ji. This matches the natal and palace-stem table used by the site.

  10. iztro 2.5.8: chart configuration and entry points

    The runtime defaults use yearDivide normal, dayDivide forward and algorithm default; the version is pinned for reproducibility.

  11. NOAA: General Solar Position Calculations

    Provides the longitude, UTC-offset and equation-of-time relationship. The site uses its own approximate equation of time, not NOAA’s full implementation.

Compare the example with your own chart

Create the free twelve-palace chart and summary. A full AI reading is available separately.

Open the free calculator