Home › Chinese Calendar › Bazi Four Pillars (八字)
Bazi Four Pillars (八字)
Builds the Bazi (八字, Bāzì) / Four Pillars (四柱) chart of a birth date and time: year pillar by 立春 (Lìchūn), month pillar by the 节 (jié) solar terms, day pillar from the sexagenary day count, hour pillar by the 五鼠遁 (Wǔshǔdùn) rule, plus day master, five-element counts, ten gods (十神), hidden stems (藏干), 纳音 (nàyīn), void branches (空亡) and the ten-year luck pillars (大运).
When to use
You need the four stem-branch pillars (年柱 月柱 日柱 时柱) of a birth moment, the day master and its ten-god relations, element balance, or the start age and sequence of the 大运 luck pillars.
Do not use when: You only need the lunar date or zodiac of a date (use lunar-calendar-converter or chinese-zodiac), the stem-branch of a single date without an hour (use sexagenary-cycle), or an interpretation of the chart — this tool computes the traditional chart only and gives no predictions.
Formula
year = solarYearAtLichun(birth instant); month stem = ((year stem mod 5) × 2 + 2 + months since 寅) mod 10; day index = (JDN + 49) mod 60; hour stem = ((day stem mod 5) × 2 + hour branch) mod 10; hour branch = floor(((hour + 1) mod 24) / 2); true solar time = clock + (longitude − 15 × utc_offset) × 4 min + equation of time; 起运 years = days to 节 / 3
Sexagenary pillars per the Chinese calendar convention (GB/T 33661-2017 solar terms computed from Meeus' VSOP87 series, civil days at UTC+8); the birth instant is compared with the exact term instants, so births on a term day before the term keep the previous month/year. Traditional reference calculation of the Chinese calendar tradition; not a prediction and not medical, legal or financial advice.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
birth_date | date | yes | Gregorian civil date of birth in the local clock time of the birthplace (1900–2100). | |
birth_time | string | yes | Local clock time of birth, 24-hour HH:MM. 23:00–00:59 is 子时 (Zǐ hour). | |
sex | enum: male | female | yes | Sex, used only for the direction of the luck pillars (阳年男/阴年女 forward, 阴年男/阳年女 backward). | |
utc_offset_hours | number | h | default 8 | Time-zone offset of birth_time in hours (China Standard Time = 8; use the historical zone in force at birth). Range: ≥ -12, ≤ 14 |
longitude_degrees | number | ° | no | Optional east-positive longitude. When given, the clock time is converted to true solar time: correction = (longitude − 15 × utc_offset_hours) × 4 min + equation of time. Range: ≥ -180, ≤ 180 |
late_zi_next_day | boolean | default true | true: 23:00–23:59 belongs to the next day's 子时 and the day pillar advances at 23:00. false: 晚子时 convention — the day pillar stays, only the hour stem is taken from the next day. | |
include_hidden_stems | boolean | default true | Add the hidden stems (藏干) of the four branches to the element count with weights 1.0 (main), 0.5 (middle) and 0.3 (residual). |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
bazi_chart | string | The eight characters in the order year, month, day, hour. | |
year_pillar | string | Stem-branch of the year; the year changes at 立春 (Start of Spring), not at Chinese New Year. | |
month_pillar | string | Stem-branch of the solar month, which starts at each 节 (odd solar term); stem by 五虎遁 (Wǔhǔdùn). | |
day_pillar | string | Stem-branch of the birth day (continuous 60-day count; 2000-01-01 = 戊午). | |
hour_pillar | string | Stem-branch of the double-hour; stem by 五鼠遁 from the day stem. | |
pillars_pinyin | object | Pinyin of the four pillars. | |
pillars_english | object | Stem element + branch animal of each pillar, e.g. Fire Horse. | |
day_master | string | The day stem, its pinyin, polarity and element; all ten-god relations are taken from it. | |
zodiac | string | Animal of the year pillar branch (立春 boundary). | |
five_element_counts | object | Raw counts of Wood/Fire/Earth/Metal/Water over the 8 characters; with include_hidden_stems also weighted counts that add hidden stems at 1.0/0.5/0.3. | |
missing_elements | string_list | Elements absent from the 8 visible characters (empty list when all five are present). | |
dominant_element | string | Element with the highest raw count (ties listed together). | |
ten_gods | object | Relation of each other stem, and of the main hidden stem of each branch, to the day master. | |
hidden_stems | object | Hidden stems of each pillar's branch in main/middle/residual order. | |
nayin | object | Nayin melodic element of each pillar. | |
void_branches | string | The two branches not covered by the day pillar's 旬 (xún, ten-day decade). | |
luck_direction | string | Forward (顺行) for yang-year males and yin-year females, backward (逆行) otherwise. | |
luck_start_age | string | Age at which the first luck pillar begins: days from birth to the next (forward) or previous (backward) 节 converted at 3 days = 1 year, 1 day = 4 months. | |
luck_start_age_years | number | years | The same start age as a decimal number of years (days to the 节 ÷ 3). |
luck_pillars | list | Eight ten-year luck pillars with start age (completed years) and calendar year; forward = following month pillars, backward = preceding ones. | |
lunar_birth_date | string | Chinese lunar calendar date of the birth day. | |
solar_term_context | string | The 节 governing the month pillar and the next 节, in China Standard Time. | |
time_used | string | The birth time actually used for the pillars (true solar time when a longitude is given). | |
notes | string_list | Conventions applied to this chart. |
Example
1990-05-17 08:30 Beijing time, male: {"birth_date":"1990-05-17","birth_time":"08:30","sex":"male","utc_offset_hours":8} → {"year_pillar":"庚午","month_pillar":"辛巳","day_pillar":"壬午","hour_pillar":"甲辰","day_master":"壬 Ren — Yang Water (水)","pillars_english":{"year":"Metal Horse","month":"Metal Snake","day":"Water Horse","hour":"Wood Dragon"},"five_element_counts":{"wood":1,"fire":3,"earth":1,"metal":2,"water":1},"missing_elements":[],"void_branches":"申酉 (Shen, You — Monkey, Rooster)","luck_direction":"forward (顺行): yang year, male","luck_start_age":"6 years 7 months","luck_start_age_years":6.64,"luck_pillars":[{"start_age":6,"pillar":"壬午"},{"start_age":16,"pillar":"癸未"},{"start_age":26,"pillar":"甲申"},{"start_age":36,"pillar":"乙酉"},{"start_age":46,"pillar":"丙戌"},{"start_age":56,"pillar":"丁亥"},{"start_age":66,"pillar":"戊子"},{"start_age":76,"pillar":"己丑"}],"lunar_birth_date":"一九九〇年四月廿三 (lunar year 1990, month 4, day 23)"}
2000-01-01 00:30 Beijing time, female (before 立春 2000): {"birth_date":"2000-01-01","birth_time":"00:30","sex":"female","utc_offset_hours":8} → {"year_pillar":"己卯","month_pillar":"丙子","day_pillar":"戊午","hour_pillar":"壬子","day_master":"戊 Wu — Yang Earth (土)","five_element_counts":{"wood":1,"fire":2,"earth":2,"metal":0,"water":3},"missing_elements":["Metal (金)"],"void_branches":"子丑 (Zi, Chou — Rat, Ox)","luck_direction":"forward (顺行): yin year, female","luck_start_age":"1 year 9 months","luck_pillars":[{"start_age":1,"pillar":"丁丑"},{"start_age":11,"pillar":"戊寅"},{"start_age":21,"pillar":"己卯"},{"start_age":31,"pillar":"庚辰"},{"start_age":41,"pillar":"辛巳"},{"start_age":51,"pillar":"壬午"},{"start_age":61,"pillar":"癸未"},{"start_age":71,"pillar":"甲申"}],"ten_gods":{"year_stem":"己 → 劫财 (Jiecai, Rob Wealth)","month_stem":"丙 → 偏印 (Pianyin, Indirect Resource)","hour_stem":"壬 → 偏财 (Piancai, Indirect Wealth)"}}
GET https://tttkmbb.com/api/v1/calculate/bazi-four-pillars?birth_date=1990-05-17&birth_time=08%3A30&sex=male&utc_offset_hours=8
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/bazi-four-pillars(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/bazi-four-pillars · Markdown: https://tttkmbb.com/lunar/bazi-four-pillars.md · JSON definition: https://tttkmbb.com/lunar/bazi-four-pillars.json
- MCP: server
https://tttkmbb.com/mcp, toolcalculate_bazi_four_pillars - OpenAPI operationId:
calculate_bazi_four_pillars - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Four Pillars of Destiny (Wikipedia) (reference)
- Sexagenary cycle (Wikipedia) (reference)
- Hong Kong Observatory – Gregorian-Lunar Calendar Conversion Table (government)
FAQ
Why does the year pillar differ from the Chinese New Year zodiac?
Bazi years begin at 立春 (about 4 February), not at Chinese New Year, so a birth on 2000-01-01 belongs to the 己卯 year although the 庚辰 lunar year would begin on 2000-02-05.
What happens at 23:00?
With late_zi_next_day = true (default) the day pillar and hour pillar are taken from the next day at 23:00. With false the day pillar stays and only the hour stem is derived from the next day's stem (晚子时 convention).
Should I enter the longitude?
Practitioners who use true solar time enter it: the clock time is shifted by 4 minutes per degree from the zone meridian (120° E for UTC+8) plus the equation of time (−14 to +16 minutes over the year). Leave it empty to use clock time.
Related calculators
- Chinese Almanac Day (黄历) — Day officer, spirits and taboos of any date in the same calendar.
- Sexagenary Cycle Calculator (干支) — Stem-branch of a date without the hour pillar.
- Chinese Double-Hour Calculator (时辰) — Double-hour (时辰) of a clock time.