gen3ric-labs
← AI Lab Work

Hobbies & builds · May 2026 · with Claude Delivered B+

Building a Four Pillars (BaZi) chart, step by step

A traditional Chinese birth chart is really a small calendar calculation. Here is how the pieces fit, using a made-up person so you can follow along.

The project

I asked for a Four Pillars chart (BaZi, "eight characters"), a written reading in both Chinese and English, and an interactive view of the result. The interactive view highlights the day master and shows the five-element balance, a ten-gods grid and a row of luck pillars. This page explains each of those pieces using a fictional sample person (born 15 June 1990 at 12:00 noon), so no real birth data appears anywhere.

Try it with your own date. The Four Pillars chart generator builds this same chart for any birth date and time, in your browser, with nothing sent or saved.

The building blocks

A chart is made of two alphabets:

One stem plus one branch makes a pillar. The chart has four pillars (year, month, day, hour), so eight characters, which is where "BaZi" comes from. Stems and branches pair up in a repeating cycle of 60, and every year, month, day and two-hour block lands somewhere on that cycle.

Each character carries an element and, for stems, a polarity:

StemsElementPolarity
甲 乙Woodyang, yin
丙 丁Fireyang, yin
戊 己Earthyang, yin
庚 辛Metalyang, yin
壬 癸Wateryang, yin

Branches map to elements too: 寅 卯 are wood, 巳 午 fire, 申 酉 metal, 亥 子 water, and 辰 戌 丑 未 earth. The five elements relate to each other in two cycles. In the generating cycle, wood feeds fire, fire makes earth, earth bears metal, metal carries water and water nourishes wood. In the controlling cycle, wood breaks earth, earth dams water, water puts out fire, fire melts metal and metal cuts wood.

Which date and time makes which pillar

The part that surprises people is that the pillars do not follow the ordinary calendar:

Traditionally the hour is also adjusted to local solar time, which is one reason two tools can disagree for someone born near a boundary.

The worked sample

Each card is one pillar: the ten-god label on top, the stem above the branch, and the hidden stems tucked inside the branch at the bottom. Characters are colored by element. I show year to hour from left to right for readability. Traditional charts are written the other way round.

YEAR Rob Wealth 庚 yang metal 午 fire hidden: 丁 己 MONTH Hurting Officer 壬 yang water 午 fire hidden: 丁 己 DAY Day master 辛 yin metal 亥 water hidden: 壬 甲 HOUR Direct Wealth 甲 yang wood 午 fire hidden: 丁 己

Sample chart: 15 June 1990, 12:00, a fictional person. The day pillar is outlined.

The day master

The day stem is "you" in the chart, so everything else is described relative to it. Here it is 辛, yin metal, traditionally pictured as fine jewelry rather than a raw ore. Once you know the day master, every other stem and branch gets a role.

Counting the five elements

A first-pass balance counts the eight visible characters (four stems and the main element of each branch):

Fire 3 Metal (day master) 2 Water 2 Wood 1 Earth 0

Fire 3, metal 2, water 2, wood 1, earth 0.

Practitioners go further: the month branch counts for much more than the others, and hidden stems add weight. In this sample the month is a fire month and fire dominates, so the metal day master sits under pressure, and earth (the element that feeds metal) shows up only as a hidden stem inside the three 午 branches. That is the kind of observation the element bars exist to make visible.

The ten gods

Each other stem is named by its relationship to the day master: the same element, the element it produces, the element it controls, the element that controls it, or the element that produces it, in each case split by whether the polarity matches. For a 辛 day master the ten gods are:

RelationshipSame polarityOpposite polarity
Same elementFriend 辛Rob Wealth 庚
Element it produces (water)Eating God 癸Hurting Officer 壬
Element it controls (wood)Indirect Wealth 乙Direct Wealth 甲
Element that controls it (fire)Seven Killings 丁Direct Officer 丙
Element that produces it (earth)Indirect Resource 己Direct Resource 戊

In the sample, the year stem 庚 is Rob Wealth, the month stem 壬 is Hurting Officer and the hour stem 甲 is Direct Wealth. The labels on the cards above come straight from this table.

Luck pillars

Every ten years the chart moves to a new stem-and-branch pair, called a luck pillar. The direction and start age come from a rule: for a yang-year male or yin-year female the sequence runs forward from the month pillar, otherwise backward, and the start age comes from counting the days to the nearest solar term (three days equals one year). For the sample it runs forward and begins at about 7 years 5 months.

age 8 1997 癸 未 age 18 2007 甲 申 age 28 2017 乙 酉 age 38 2027 丙 戌 age 48 2037 丁 亥 age 58 2047 戊 子 age 68 2057 己 丑 age 78 2067 庚 寅

The first luck pillar is listed at age 8, in 1997. Only the pillars through age 78 are shown.

How I calculated it

Calendar logic with solar terms is easy to get subtly wrong, so I don't hand-roll it. For this sample I used the open-source lunar-python library, then checked the month and hour stems by hand against the standard rules for deriving them:

from lunar_python import Solar

solar = Solar.fromYmdHms(1990, 6, 15, 12, 0, 0)
bazi = solar.getLunar().getEightChar()
print(bazi.getYear(), bazi.getMonth(), bazi.getDay(), bazi.getTime())
# 庚午 壬午 辛亥 甲午

luck = bazi.getYun(1)   # 1 = male, 0 = female; sets the luck-pillar direction

What I'd say to a skeptic

I treat Four Pillars as a traditional, rule-based system that is worth understanding, not as a forecast. The engineering side is the interesting part: a deterministic calculation with real edge cases (solar-term boundaries to the minute, time zones, daylight saving, two-hour hour blocks). If you make a chart for anyone, cross-check it against a second calendar tool before trusting it, especially when the birth falls near a solar term or on the edge of a two-hour block.

This is entry 06 of AI Lab Work.