Standard Table
Top

Lunisolar Calendar

Lunisolar Calendar is used in many cultures. Its months are based on moon phases, while the years are roughly aligned with the solar calendar. It is a lunar calendar, but with a leap month every two or three years.

Chinese Calendar

Also known as the Agricultural Calendar (農曆 Nóng Lì), is believed to be the origin of some lunisolar calendar variants in the region.

Apart from the month and dates, the Chinese Calendar follow a sexagenary cycle, the Gān Zhī (干支) system. It's a repeating cycle of 10 Heavenly Stems (十天干) and 12 Earthly Branches (十二枝) that form 60 pairs or terms. Odd-even and Even-odd numbered pairing are not included, resulting in only 60 combinations instead of 120. These terms are cycled independently on years, months, days and hours. The 4 terms are referred to as the Four Pillars (四柱), which consist of 4 pairs of Heavenly Stem and Earthly Branch. This is also referred to as the Bā Zì (八字), literally meaning 8 characters. There are also elements are associated with each heavenly stem and zodiac animals associated with each earth branch.

10 Heavenly Stems (十天干)

# Heavenly Stem Element
1JiǎWood
2Wood
3BǐngHuǒFire
4DīngHuǒFire
5Earth
6Earth
7GēngJīnMetal
8XīnJīnMetal
9RénShuǐWater
10GuǐShuǐWater

12 Earthly Branches (十二枝)

# Earthly Branch Zodiac Animal
1ShǔRat
2ChǒuNiúOx
3YínTiger
4MǎoRabbit
5ChénLóngDragon
6ShéSnake
7Horse
8WèiYángGoat
9ShēnHóuMonkey
10YǒuChicken
11GǒuDog
12HàiZhūPig

Sexagenary cycle - Gān Zhī (干支) system

# Gānzhī (干支) Element-Zodiac
1甲子Jiǎ Zǐ木鼠Wood Rat
2乙丑Yǐ Chǒu木牛Wood Ox
3丙寅Bǐng Yín火虎Fire Tiger
4丁卯Dīng Mǎo火兔Fire Rabbit
5戊辰Wù Chén土龙Earth Dragon
6己巳Jǐ Sì土蛇Earth Snake
7庚午Gēng Wǔ金马Metal Horse
8辛未Xīn Wèi金羊Metal Goat
9壬申Rén Shēn水猴Water Monkey
10癸酉Guǐ Yǒu水鸡Water Chicken
11甲戌Jiǎ Xū木狗Wood Dog
12乙亥Yǐ Hài木猪Wood Pig
13丙子Bǐng Zǐ火鼠Fire Rat
14丁丑Dīng Chǒu火牛Fire Ox
15戊寅Wù Yín土虎Earth Tiger
16己卯Jǐ Mǎo土兔Earth Rabbit
17庚辰Gēng Chén金龙Metal Dragon
18辛巳Xīn Sì金蛇Metal Snake
19壬午Rén Wǔ水马Water Horse
20癸未Guǐ Wèi水羊Water Goat
21甲申Jiǎ Shēn木猴Wood Monkey
22乙酉Yǐ Yǒu木鸡Wood Chicken
23丙戌Bǐng Xū火狗Fire Dog
24丁亥Dīng Hài火猪Fire Pig
25戊子Wù Zǐ土鼠Earth Rat
26己丑Jǐ Chǒu土牛Earth Ox
27庚寅Gēng Yín金虎Metal Tiger
28辛卯Xīn Mǎo金兔Metal Rabbit
29壬辰Rén Chén水龙Water Dragon
30癸巳Guǐ Sì水蛇Water Snake
31甲午Jiǎ Wǔ木马Wood Horse
32乙未Yǐ Wèi木羊Wood Goat
33丙申Bǐng Shēn火猴Fire Monkey
34丁酉Dīng Yǒu火鸡Fire Chicken
35戊戌Wù Xū土狗Earth Dog
36己亥Jǐ Hài土猪Earth Pig
37庚子Gēng Zǐ金鼠Metal Rat
38辛丑Xīn Chǒu金牛Metal Ox
39壬寅Rén Yín水虎Water Tiger
40癸卯Guǐ Mǎo水兔Water Rabbit
41甲辰Jiǎ Chén木龙Wood Dragon
42乙巳Yǐ Sì木蛇Wood Snake
43丙午Bǐng Wǔ火马Fire Horse
44丁未Dīng Wèi火羊Fire Goat
45戊申Wù Shēn土猴Earth Monkey
46己酉Jǐ Yǒu土鸡Earth Chicken
47庚戌Gēng Xū金狗Metal Dog
48辛亥Xīn Hài金猪Metal Pig
49壬子Rén Zǐ水鼠Water Rat
50癸丑Guǐ Chǒu水牛Water Ox
51甲寅Jiǎ Yín木虎Wood Tiger
52乙卯Yǐ Mǎo木兔Wood Rabbit
53丙辰Bǐng Chén火龙Fire Dragon
54丁巳Dīng Sì火蛇Fire Snake
55戊午Wù Wǔ土马Earth Horse
56己未Jǐ Wèi土羊Earth Goat
57庚申Gēng Shēn金猴Metal Monkey
58辛酉Xīn Yǒu金鸡Metal Chicken
59壬戌Rén Xū水狗Water Dog
60癸亥Guǐ Hài水猪Water Pig

24 Solar Terms (二 十 四 節 氣)

The chinese use 24 terms to align with the seasons. These seasons are related to the Earth's orbit around the Sun, which make them fall on the same Gregorian dates (may vary by a day) every year. These Solar Terms are also mapped to 12 seasons, which are used for computing Ba Zi Month Pillar instead of the Lunisolar month.

Type Solar Term Month/Season Number Start (Gregorian Date)
Major
中氣
立春
Lì Chūn
Beginning of Spring12/4
Minor
節氣
雨水
Yǔ Shuǐ
Rain Water12/19
Major
中氣
惊蛰
Jīng Zhé
Awakening of Insects23/6
Minor
節氣
春分
Chūn Fēn
Spring Equinoz23/21
Major
中氣
清明
Qīng Míng
Pure Brightness34/5
Minor
節氣
谷雨
Gǔ Yǔ
Grain Rain34/20
Major
中氣
立夏
Lì Xià
Beginning of Summer45/6
Minor
節氣
小满
Xiǎo Mǎn
Grain Buds45/21
Major
中氣
芒种
Máng Zhòng
Grain in Ear 56/6
Minor
節氣
夏至
Xià Zhì
Summer Solstice 56/21
Major
中氣
小暑
XiǎoShǔ
Minor Heat67/7
Minor
節氣
大暑
Dà Shǔ
Major heat67/23
Major
中氣
立秋
Lì Qiū
Beginning of Autumn78/8
Minor
節氣
处暑
Chǔ Shǔ
End of Heat78/23
Major
中氣
白露
Bái Lù
White Dew89/8
Minor
節氣
秋分
Qiū Fēn
Autumn Equinox89/23
Major
中氣
寒露
Hán Lù
Cold Dew910/8
Minor
節氣
霜降
Shuāng Jiàng
Frost's Descent910/23
Major
中氣
立冬
Lì Dōng
Beginning of Winter 1011/7
Minor
節氣
小雪
Xiǎo Xuě
Minor Snow1011/22
Major
中氣
大雪
Dà Xuě
Major Snow1112/7
Minor
節氣
冬至
Dōng Zhì
Winter Solstice1112/22
Major
中氣
小寒
Xiǎo Hán
Minor Cold121/6
Minor
節氣
大寒
Dà Hán
Major Cold121/20

Bā Zì (八字) Formula

The following are formulas to compute Ba Zi for a given date. You'll need both the Lunisolar Date, Gregorian Date and Corresponding Solar Term Month/Year. Refer to the tables above to map the # to the character. The formulas are zero-based (i.e. row 1 is 0).

Bā Zì
(八字)
Formula Notes
Year Heavenly Stem # (Lunisolar Year + 6)%10 Lunisolar 1900: 6 as initial value; No need to subtract 1900 since mod 10
Year Earthly Branch # (Lunisolar Year-1900)%12 Lunisolar 1900: 0 as initial value; Plus 12 to result if negative
Month Heavenly Stem # (Solar Term Year*12 + Solar Term Month # + 3)%10 Lunisolar Jan 1900: 4 as initial value; +3 = -1 + 4 No need to subtract 1900 since mod 10;

Note that Solar Term Year should be the previous lunar year if the Gregorian Date is less than the first cut off (i.e. Feb 4)
Month Earthly Branch # Solar Term Month # + 1 Lunisolar Jan 1900: 2 as initial value; +1 = -1 +2
Day Heavenly Stem # (Gregorian days since Jan 31, 1900)%10 Gregorian Date Jan 31, 1900; 0 being the initial value; Plus 10 to result if negative
Day Earthly Branch # ((Gregorian days since Jan 31, 1900)+4)%12 Gregorian Date Jan 31, 1900; 4 as initial value; Plus 12 to result if negative
Hour Heavenly Stem # ((Day Heavenly Stem #%5)*2 + Floor((Military Hour + 1)/2))%10 60-term cycles every 5 days (10 across 12 terms a day), with the next day +2 stems, both initial values are 0; +1 hour so that 11pm-1am/23 to 1 is 0
Hour Earthly Branch # Floor((Military Hour + 1)/2)%12 +1 hour so that 11pm-1am/23 to 1 is 0

The above formulas use Lunisolar Date Jan 1, 1900 / Gregorian Date Jan 31, 1900 as anchor. Below are the Year, Month and Day terms for the said date:

Pillar Term Heavenly Stem # Earthly Branch #
Year 庚子 Gēng Zǐ 6 0
Month 戊寅 Wù Yín 4 2
Day 甲辰 Jiǎ Chén 0 4

You may also use different anchor dates for each entry to futher simplify the formulas. Leap months do not factor in the formulas as the Solar Term Months are aligned with the Gregorian Calendar (i.e. 12 months a year).