BaZi · Blog

Heavenly Stems and Earthly Branches Calculation

Deep Oracle Practitioner Desk · 2026-09-19 · 3 min read

The sexagenary pairing known as 天干地支 is computed from two remainder operations for the year pillar. The heavenly stem and earthly branch are not read from a single cycle but are derived separately: subtract four from the Common Era year, then take the remainder modulo ten for the stem position and modulo twelve for the branch position. These two results are then combined to produce one of the sixty pairs used in the sexagenary cycle.

年干与年支各自取余

For the year pillar, the stem and branch are obtained by independent remainder calculations. Given a year expressed in the Common Era system, subtract four from the year. Divide the result by ten; the remainder gives the position of the heavenly stem. Divide the same result by twelve; the remainder gives the position of the earthly branch. The two positions are not interchangeable. The modulo-ten result locates the stem among the ten characters 甲乙丙丁戊己庚辛壬癸, while the modulo-twelve result locates the branch among the twelve characters 子丑寅卯辰巳午未申酉戌亥. Only after both remainders are obtained can a complete year pillar be written.

一九八四年是哪一组

The anchor point used by this engine is that 1984 corresponds to 甲子. Both remainder formulas derive from that anchor. Subtracting four from 1984 leaves 1980. The remainder of 1980 divided by ten is zero, and zero corresponds to the first stem, 甲. The remainder of 1980 divided by twelve is also zero, and zero corresponds to the first branch, 子. The pair is therefore 甲子. Working backward or forward from that anchor by the same two modulo operations reproduces the sequence of sixty year pillars.

公式的输入必须是哪一种年

The input to this formula must be the fate-calendar year, not the ordinary Gregorian calendar year. The fate-calendar year begins at 立春, the beginning of spring, rather than at January 1 or at the lunar new year. A person born before 立春 in a given Gregorian year still belongs to the previous year pillar. The Gregorian year number alone is insufficient in that interval. If the birth date falls before the 立春 boundary, one must subtract one from the Gregorian year before applying the remainder formulas.

立春前出生怎么修正

For a birth before 立春, the correction is to use the previous year as the year number in the formula. If someone is born in early January or in the days of February before 立春, the Gregorian year may look like the current year, but the year pillar still belongs to the prior year. The formula should therefore be fed the prior year. The boundary for the Chinese zodiac animal is 春节, the lunar new year, while the boundary for the year pillar is 立春. The two boundaries generally differ by about half a month. In the window from January 1 to 春节, directly substituting the Gregorian year into the formula will produce a result that is one position later than the correct year pillar.

用它核对一张现成的盘

The year pillar is the only pillar among the four that can be derived from the year alone. Once the year stem is fixed, the month stem is derived from it by the 五虎遁 method, so an error in the year pillar will carry through to the month pillar. The month branch depends on the solar month, but the month stem depends on the year stem. If the year stem is wrong because the Gregorian year was used across a 立春 boundary, the month stem will also be wrong. The day pillar and hour pillar require additional inputs and cannot be checked by this year-based formula alone. When using the formula to verify an existing chart, first confirm that the year has been adjusted for 立春, then check that the year stem and branch match the two remainder results, and only then compare the month stem derived from the corrected year stem.

Heavenly Stems and Earthly Branches Calculation