← Back to The Study
Bazi Foundations

How the Bazi Engine Works

A Bazi (八字) reading begins with eight characters — four Heavenly Stems and four Earthly Branches derived from your birth date and time. The math behind those eight characters is precise, ancient, and surprisingly simple once unpacked. Here is how the engine actually runs, from solar terms to Luck Pillars.

Quick answer. The Bazi engine takes one input — your exact birth moment — and computes the Year, Month, Day, and Hour pillars, each holding one of ten Heavenly Stems (天干) and one of twelve Earthly Branches (地支). From those eight characters it derives your Day Master (日主), the hidden stems lurking in each branch, the Ten Gods relationships, and the timing of the Luck Pillars (大运) that govern each decade. The astronomy is exact; the interpretation is the practitioner's craft.

I

The Eight Characters — Bā Zì

Bazi literally means eight characters. The system takes your birth moment and renders it as a 4×2 grid: four time pillars (Year, Month, Day, Hour) and two characters per pillar (one Heavenly Stem, one Earthly Branch). The characters are chosen from the same sexagenary cycle (六十甲子) the Chinese calendar has used for over three thousand years.

The full grid for someone born on, say, 15 June 1990 at 14:30 in Shanghai might look like this:

PillarStem (天干)Branch (地支)Element of stem
Year庚 Gēng午 WǔYang Metal
Month壬 Rén午 WǔYang Water
Day丁 Dīng未 WèiYin Fire ← Day Master
Hour丁 Dīng未 WèiYin Fire

That single grid encodes more information than it looks. The Day stem (here 丁 Yin Fire) becomes the Day Master — the chart's I, the reference point against which everything else is measured. The branches each carry hidden stems. The relationships between the eight characters and the Day Master become the Ten Gods. The pillars themselves are sequenced into Luck Pillars that move through the decades of the life. The engine derives all of this from one input: a moment in time at a place on Earth.

II

Solar Terms — Why Calendar Months Don't Apply

The first thing a working Bazi practitioner has to internalise: the Bazi calendar does not use the Gregorian month, the lunar month, or the solar year boundary you might expect. It uses the 24 solar terms (二十四节气) — twenty-four points in the Sun's apparent path along the ecliptic, each fifteen degrees apart.

These solar terms anchor everything. The Bazi year does not begin on January 1 or even on the lunar new year. It begins at Lichun (立春), the start of spring, which falls on or near February 4 each year — the moment the Sun reaches 315° celestial longitude. Similarly, the Bazi month does not begin on the first of any calendar month; it begins at one of the twelve "section-starting" solar terms (节, jié), each of which marks the Sun crossing a 30° boundary.

The twelve month-starting terms:

Modern Bazi engines compute these solar terms to the second, using ephemeris-grade Newton-Raphson iteration on the Sun's apparent longitude. Cosmos Daily's engine uses the same Meeus astronomical algorithms (Chapter 25 for Sun position) that astronomers use, accurate to within seconds for any year between 1900 and 2100.

Why precision matters: a person born February 4 at 11:00 a.m. and another born February 4 at 11:30 a.m. of the same year may be in different Bazi years if Lichun fell at 11:15 a.m. between them. The Year and Month pillars depend on which side of the term boundary the birth moment falls. Sloppy engines round to whole days and corrupt the chart for everyone born within a day of a term boundary.

III

The Day Pillar — A Continuous Day Counter

The Year and Month pillars depend on solar terms; the Day pillar depends on something simpler and even more precise: the count of days from a known reference point. Bazi uses the sexagenary day cycle, a 60-day rotation of stem-branch combinations that has been running unbroken for thousands of years.

The mathematics is straightforward. Given any date with a known Bazi day pillar (an "anchor" day), every subsequent date increments through the 60-day cycle. Given the Julian Day Number (JD) for any date, the day pillar is:

stem_index = (JD + offset) mod 10 branch_index = (JD + offset) mod 12 day_pillar = stems[stem_index] + branches[branch_index]

The offset is calibrated against historical anchor dates documented in the classical texts. Once calibrated, every day pillar from antiquity to the year 9999 is deterministically computable. There is no ambiguity. The day a person was born has exactly one Day pillar.

One subtlety: the Bazi day boundary is not midnight. It is 23:00 local time. A person born at 23:30 on June 14 is in the Day pillar for June 15, not June 14. This is the classical 子 Zǐ hour boundary; modern engines respect it.

IV

The Hour Pillar — 12 Two-Hour Blocks

The traditional Chinese day is divided into twelve two-hour blocks (时辰, shíchen), each governed by an Earthly Branch. The blocks start at 23:00 and roll forward in two-hour increments:

BlockBranchAnimalElement
23:00–01:00子 ZǐRatYang Water
01:00–03:00丑 ChǒuOxYin Earth
03:00–05:00寅 YínTigerYang Wood
05:00–07:00卯 MǎoRabbitYin Wood
07:00–09:00辰 ChénDragonYang Earth
09:00–11:00巳 SìSnakeYin Fire
11:00–13:00午 WǔHorseYang Fire
13:00–15:00未 WèiGoatYin Earth
15:00–17:00申 ShēnMonkeyYang Metal
17:00–19:00酉 YǒuRoosterYin Metal
19:00–21:00戌 XūDogYang Earth
21:00–23:00亥 HàiPigYin Water

The hour stem derives from the day stem using the classical 五鼠遁 (Wǔ Shǔ Dùn, "Five Rat Concealment") rule: the stem of the 子 Zǐ hour on a given day depends on which day stem is in effect. The same kind of derivation rule, called 五虎遁 (Wǔ Hǔ Dùn, "Five Tiger Concealment"), is used to derive month stems from year stems. Both rules are deterministic mappings; the engine just looks them up.

The Bazi engine does not simulate astrology. It performs astronomy and calendar mathematics to a known precision, and hands the result to the practitioner as the chart's hard, true substrate.

V

The Day Master

Of all eight characters, the most important is the Day stem — the Day Master (日主, Rì Zhǔ). This single character represents you. It is the reference point for every other interpretation in the chart.

There are ten possible Day Masters — five elements (Wood, Fire, Earth, Metal, Water) crossed with Yin/Yang polarity:

StemElementYang/YinImage
甲 JiǎWoodYangGreat tree, oak
乙 YǐWoodYinVine, grass, flowers
丙 BǐngFireYangThe Sun, blazing fire
丁 DīngFireYinCandle flame, lamp
戊 WùEarthYangMountain, rock
己 JǐEarthYinGarden soil, field
庚 GēngMetalYangSword, axe, raw ore
辛 XīnMetalYinJewel, refined metal
壬 RénWaterYangOcean, great river
癸 GuǐWaterYinRain, dew, mist

The first reading-day question is: is this Day Master strong or weak? A Day Master is strong if the chart contains many supporting elements (the same element, or the element that produces it) and weak if the chart is dominated by elements that drain or control it. The strength assessment determines what the chart needs (favourable elements, 用神 yòng shén) and what destabilises it (unfavourable elements, 忌神 jì shén). Every interpretive move that follows depends on this initial diagnosis.

VI

Hidden Stems — What Lies Beneath

Each Earthly Branch contains one to three Heavenly Stems hidden inside it — sub-elements that the surface character does not announce. These are called 藏干 (cáng gān, "stored stems") or simply hidden stems.

For example, the branch 寅 Yín (Tiger) contains three hidden stems:

Practitioners read hidden stems to find what the surface chart does not show. A Day Master that looks weak based on the visible stems may be secretly supported by hidden stems in the day branch. A talent that doesn't appear in any visible position may live entirely in the hidden stems and only manifest in specific Luck Pillar windows that activate it.

The full table of hidden stems for all twelve branches is part of the engine's reference data. Cosmos Daily uses the standard Yuan Tian Gang attributions used in mainstream classical Bazi practice.

VII

The Ten Gods

Once the Day Master is fixed, every other stem in the chart receives a Ten Gods (十神, Shí Shén) label based on its relationship to the Day Master. The label depends on two things: whether the other stem produces, controls, or is controlled by the Day Master's element, and whether it shares the Day Master's polarity (same Yin/Yang) or opposes it.

The ten labels:

Ten GodRelationshipDomain
比肩 Bǐ JiānSame element, same polarityPeer, friend, sibling, equal
劫财 Jié CáiSame element, opposite polarityRival, the wealth-stealer, competitor
食神 Shí ShénDM produces it, same polarityOutput, expression, creativity, performance
伤官 Shāng GuānDM produces it, opposite polarityHurt-Officer, rebellion, talent that wounds authority
正财 Zhèng CáiDM controls it, opposite polarityEarned wealth, formal income, the spouse (if male)
偏财 Piān CáiDM controls it, same polaritySpeculative wealth, side income, fortune from movement
正官 Zhèng GuānControls DM, opposite polarityOfficer, formal authority, structure, the husband (if female)
七杀 Qī ShāControls DM, same polaritySeven Killings, sharp authority, the trial that forges
正印 Zhèng YìnProduces DM, opposite polarityDirect Resource, support, mother, study
偏印 Piān YìnProduces DM, same polarityIndirect Resource, unconventional learning, the inner teacher

The Ten Gods are Bazi's vocabulary for relationships, career, family, and timing. A chart with a strong 正官 Zhèng Guān is built for institutional authority. A chart with a clear 食神 Shí Shén is built for creative output. A chart where the 财 Cái element is in a Day branch hidden stem may produce wealth that surfaces only when a specific Luck Pillar activates it. Ten Gods analysis is where Bazi becomes interpretively rich — and where the engine's job ends and the practitioner's begins.

VIII

Luck Pillars — The Decade Clock

The natal chart is fixed for life. But a separate engine output runs alongside it: the Luck Pillars (大运, Dà Yùn), ten-year periods that interact with the natal chart and govern the elemental weather of each decade.

Luck Pillars are calculated by counting forward (or backward, depending on the gender and the polarity of the Year stem) from the Month pillar through the sexagenary cycle of stem-branch combinations. The first Luck Pillar begins at a specific age (calculated from the distance in days between the birth moment and the next or previous solar term, then divided by 3). Every ten years thereafter, a new pillar replaces the previous one.

The classical rule:

Each Luck Pillar carries one stem and one branch with their associated elements. Whether that decade is favourable depends entirely on whether the pillar's elements support the Day Master (favourable) or destabilise it (unfavourable). Bazi practitioners read the Luck Pillars as the long arc of the life — the seasons of the soul, ten years at a time. A weak Day Master in a favourable Luck Pillar can flourish; a strong Day Master in a clashing Luck Pillar can be tested in ways that look like external misfortune but are precisely the chart in conversation with time.

Layered on top of the Luck Pillars are Annual Pillars (流年, Liú Nián) — the year's own stem-branch — and Monthly Pillars (流月, Liú Yuè). Together with the Luck Pillar, these three timing layers form the Bazi practitioner's predictive grid: the decade, the year, and the month, each interacting with the natal chart in specific ways.

See your own eight characters

Cosmos Daily's Bazi engine computes your Year, Month, Day, and Hour pillars to the second, with hidden stems, Ten Gods, and the Luck Pillar clock for your full life arc.

Cast your Bazi chart →
IX

What the Engine Does Not Decide

Everything described above is calculation. It is precise, deterministic, and reproducible. Two competent engines given the same birth moment will produce the same eight characters, the same hidden stems, the same Ten Gods labels, and the same Luck Pillar sequence. There is no interpretation in any of it.

What is not determined by the engine: the strength assessment of the Day Master in borderline cases (different schools weight stem-branch contributions differently), which Ten God to emphasise as the chart's controlling theme, how to read element clashes, and the operative instruction for the year. These are the practitioner's craft. A good engine gives the practitioner a clean, true substrate. The reading is what they build from there.

The Cosmos Daily engine is built for accuracy at the substrate. When you cast a chart, you can trust that the eight characters, the hidden stems, and the Luck Pillar timing are correct. The reading sits on top of that substrate as Bazi practice has done for two thousand years — a working method, not a magic trick.

X

Frequently Asked

What if I don't know my exact birth time?

The Year, Month, and Day pillars can be computed from the date alone with high accuracy — the only ambiguity is people born within a few minutes of a solar-term boundary or the 23:00 day boundary. The Hour pillar requires a known birth time; without it, you have a six-character chart instead of an eight-character one. A six-character chart is still readable but loses information about daily timing and the spouse axis.

Do I use my local time zone or Beijing time?

Local solar time at the birthplace, ideally. Most people use the standard time zone of their birthplace, which is close enough for most purposes. Borderline cases (births within minutes of an hour boundary) benefit from converting to true local solar time using longitude.

What about Daylight Saving Time?

If your birth was during DST, the standard time (DST minus one hour) is the one to use. The Bazi calendar is anchored to the Sun, not to civic time policy.

How does the engine handle leap years?

The Bazi calendar is solar-anchored, so leap days don't cause problems. The Year and Month boundaries are tied to specific solar longitudes; they fall slightly differently each Gregorian year because of the leap-year adjustment, and the engine computes them directly from astronomy rather than from the calendar.

Why does my Bazi look different on different sites?

Most discrepancies come from sloppy time-zone handling, midnight-vs-23:00 day boundaries, or rounded solar terms. A second-precision engine like Cosmos Daily's will agree with the classical Chinese published almanacs (万年历) to the day pillar for any birth moment. Where engines disagree, follow the one that uses real astronomy.