Decode Your Destiny with Imperial BaZi
Translate your Gregorian birth date into the Four Pillars of Destiny (Sì Zhù). Discover your Day Master, balance your Five Elements, and navigate your 10-year major Luck Pillars.
The Core Pillars of Astrology
Our professional engine calculates astronomical cycles based on true solar terms rather than generic years.
1. Locate Your Day Master
The Day Master is the Heavenly Stem of your birth day. It is your astrological soul DNA, revealing your core character, intrinsic talents, and psychological strengths.
Explore all 10 Day Masters2. Balance Five Elements
Wood, Fire, Earth, Metal, and Water shape your physical and mental balance. Discover missing elements, and find your Useful God (Yong Shen) to bring energy back into sync.
Learn about element charts3. Relationship Synergy
By evaluating spouse house stems and earthly branch combinations/clashes, our engine calculates relationship friction, marriage ease, and alchemical attraction points.
Read compatibility guideHow This Calculator Works — Algorithm & Method
Library: lunar-javascript (astronomical) · Deterministic calculation — no AI interpolation
Core Structures (Traditional Chinese Metaphysics)
| Structure | Count | Values / Notes |
|---|---|---|
| Heavenly Stems (天干 Tiāngān) | 10 | 甲乙丙丁戊己庚辛壬癸 — 5 elements × 2 polarities |
| Earthly Branches (地支 Dìzhī) | 12 | 子丑寅卯辰巳午未申酉戌亥 (Rat through Pig) |
| Jiazi Cycle (甲子循环) | 60 | LCM(10, 12) = 60 — full stem+branch rotation period |
| Four Pillars (八字 Bāzì) | 4 × 2 | Year · Month · Day · Hour — each = 1 Stem + 1 Branch |
| Five Elements (五行 Wǔxíng) | 5 | Wood 木 · Fire 火 · Earth 土 · Metal 金 · Water 水 |
| 10-Year Luck Pillars (大运 Dàyùn) | 8 cycles | Direction (forward/backward) determined by gender × year stem polarity |
Calculation Algorithms
// — Pillar extraction (all 4 pillars) —
solar = Solar.fromYmdHms(year, month, day, hour, min, 0)
lunar = solar.getLunar()
bazi = lunar.getEightChar()
year_stem = bazi.getYearGan() // 年干
year_branch = bazi.getYearZhi() // 年支
month_stem = bazi.getMonthGan() // 月干 ← changes at solar terms 节气
month_branch = bazi.getMonthZhi() // 月支
day_stem = bazi.getDayGan() // 日干 = Day Master
day_branch = bazi.getDayZhi() // 日支
hour_stem = bazi.getTimeGan() // 时干 ← 2-hour segments (子时 23:00-01:00...)
hour_branch = bazi.getTimeZhi() // 时支
// — Day Master Strength Score (weighted algorithm) —
// Weights: Month Branch = 35pts (season/De Ling), Day Branch = 15pts,
// other stems/branches = 8-10pts each. Total max ≈ 100pts
score += (monthBranchElement === dmElement) ? 35 : 0
score += (monthBranchElement === producerOf[dmElement]) ? 30 : 0
score += (dayBranchElement === dmElement) ? 15 : 0
score += (dayBranchElement === producerOf[dmElement]) ? 12 : 0
// + year/month/hour stems and branches: 8-10pts each
strength = score > 48 ? "Strong" : score < 32 ? "Weak" : "Balanced"
// — Ten Gods formula (十神 Shí Shén) —
diff = (indexOf(otherElement) - indexOf(dmElement) + 5) % 5
// diff=0 → Friend/Rob Wealth | diff=1 → Eating God/Hurting Officer
// diff=2 → Direct/Indirect Wealth | diff=3 → Direct/7-Killings Officer
// diff=4 → Direct/Indirect Resource
ten_god = TEN_GODS[diff][samePolarity ? 0 : 1]
// — Producing Cycle (生 shēng) —
// Water→Wood→Fire→Earth→Metal→Water
// — Controlling Cycle (克 kè) —
// Wood→Earth→Water→Fire→Metal→Wood
// — Useful God (用神 Yòng Shén) —
if (strength === "Strong") → Useful God = drain/control element (Output/Wealth/Power)
if (strength === "Weak") → Useful God = support element (Resource or same element)
if (strength === "Balanced")→ Useful God = most scarce element in the 8 characters
// — 10-Year Luck Pillars direction —
luck_forward = (gender=male AND year_stem=Yang) OR (gender=female AND year_stem=Yin)
start_age = bazi.getYun(genderCode, solar).getStartAge()
// — Longitude correction (solar time) —
local_solar_time = birth_time + 4min × (longitude − timezone_standard_longitude)Calculations use the lunar-javascript library for accurate solar term (节气) boundary detection required for Month Pillar accuracy. Day Master may vary by ±1 day for births near midnight or solar term crossings. Hour Pillar requires birth time (two-hour segments: 子时 23:00–01:00, 丑时 01:00–03:00, etc.). Longitude correction adjusts for local solar time deviation from standard timezone meridian.
Ready to discover your destiny profile?
Generate your high-accuracy four pillars report in seconds. Fully responsive and completely free of charge.