Skip to content

神煞 Almanac Flags (Shén Shà) ​

Almanac flags (神煞) are symbolic markers from traditional Chinese calendars (通書/黃曆) and fate analysis (命理學). Each flag is derived from the relationship between Heavenly Stems (天干) and Earthly Branches (地支) in a person's birth chart or a given date. Practitioners use them in BaZi (八字) chart reading and date selection (擇日) to identify auspicious and inauspicious influences.

stem-branch implements 30 almanac flags across 8 categories.

See also: Day Fitness Cycle · Virtue Stars · Deity Directions

Overview ​

CategoryAuspiciousInauspicious
Noble 貴人天乙貴人, 太極貴人, 將星, 魁罡, 三奇貴人—
Academic 文學文昌貴人, 華蓋, 學堂—
Romance 姻緣紅鸞, 天喜桃花 (context-dependent)
Travel 驛動驛馬—
Wealth 財富祿神, 金輿, 金神—
Protection 護佑天赦日, 十靈日—
Health 健康天醫—
Inauspicious 凶煞—羊刃, 劫煞, 亡神, 孤辰, 寡宿, 十惡大敗, 陰差陽錯, 月破, 歲破, 天羅, 地網, 四廢

Day Stem Derivations 日干取煞 ​

These stars are derived from the day stem (日干). The day stem determines a target branch; the star is activated when any pillar's branch matches that target.

天乙貴人 Heavenly Noble ​

The most important noble star. Each stem maps to two branches (daytime/nighttime positions).

Day StemTarget Branches
甲丑, 未
乙子, 申
丙亥, 酉
丁亥, 酉
戊丑, 未
己子, 申
庚丑, 未
辛午, 寅
壬巳, 卯
癸巳, 卯

Mnemonic: 甲戊庚牛羊(丑未), 乙己鼠猴鄉(子申), 丙丁豬雞位(亥酉), 壬癸蛇兔藏(巳卯), 六辛馬虎方(午寅).

typescript
import { getHeavenlyNoble } from 'stem-branch';
getHeavenlyNoble('甲'); // → ['丑', '未']

太極貴人 Supreme Noble ​

Day StemTarget Branches
甲, 乙子, 午
丙, 丁卯, 酉
戊, 己辰, 戌, 丑, 未
庚, 辛寅, 亥
壬, 癸巳, 申

Rule: Stems are paired by 五合 (stem combination). 甲己 share targets, 乙庚 share targets, etc.

typescript
import { getSupremeNoble } from 'stem-branch';
getSupremeNoble('戊'); // → ['辰', '戌', '丑', '未']

文昌貴人 Literary Star ​

Day Stem甲乙丙丁戊己庚辛壬癸
Target巳午申酉申酉亥子寅卯

Rule: The branch of the stem's 食神 (eating god) position.

typescript
import { getLiteraryStar } from 'stem-branch';
getLiteraryStar('甲'); // → '巳'

祿神 Prosperity Star ​

Day Stem甲乙丙丁戊己庚辛壬癸
Target寅卯巳午巳午申酉亥子

Rule: The branch where the stem is in the 臨官 (official) phase of its 12-stage life cycle.

typescript
import { getProsperityStar } from 'stem-branch';
getProsperityStar('甲'); // → '寅'

羊刃 Ram Blade ​

Day Stem甲乙丙丁戊己庚辛壬癸
Target卯寅午巳午巳酉申子亥

Rule: 陽干 = 祿 + 1 (next branch), 陰干 = 祿 - 1 (previous branch). The Ram Blade is the overextension past the prosperity peak — powerful but dangerous.

typescript
import { getRamBlade } from 'stem-branch';
getRamBlade('甲'); // → '卯'

金輿 Golden Carriage ​

Day Stem甲乙丙丁戊己庚辛壬癸
Target辰巳未申未申戌亥丑寅

Rule: 祿 + 2 (two branches past prosperity).

typescript
import { getGoldenCarriage } from 'stem-branch';
getGoldenCarriage('甲'); // → '辰'

學堂 Study Hall ​

Day Stem甲乙丙丁戊己庚辛壬癸
Target亥午寅酉寅酉巳子申卯

Rule: The branch of the stem's 長生 (birth) position in its life cycle.

typescript
import { getStudyHall } from 'stem-branch';
getStudyHall('甲'); // → '亥'

Three-Harmony Derivations 三合取煞 ​

These stars derive from the year branch (年支) via the 三合 (three-harmony) grouping system.

The Four Three-Harmony Groups ​

GroupElementBranchesTravel HorsePeach BlossomCanopyGeneralRobberyDeath Spirit
0火 Fire寅午戌申卯戌午亥巳
1金 Metal巳酉丑亥午丑酉寅申
2水 Water申子辰寅酉辰子巳亥
3木 Wood亥卯未巳子未卯申寅

Each position in the 三合 group corresponds to a stage in the 十二長生 (twelve life stages):

PositionLife StageStarMeaning
0衝 (clash)驛馬 Traveling HorseMovement, relocation
1沐浴 (bathing)桃花 Peach BlossomRomance, charm
2墓 (tomb)華蓋 CanopySolitude, spirituality
3帝旺 (emperor)將星 General StarAuthority, leadership
4絕 (extinction)劫煞 Robbery StarSudden loss, danger
5—亡神 Death SpiritHidden harm

驛馬 Traveling Horse ​

Activated when any pillar branch matches the travel horse of the year branch's 三合 group.

typescript
import { getTravelingHorse } from 'stem-branch';
getTravelingHorse('寅'); // → '申' (fire group)
getTravelingHorse('子'); // → '寅' (water group)

桃花 Peach Blossom ​

Also called 咸池. The "bathing" position — associated with attraction and romance.

typescript
import { getPeachBlossom } from 'stem-branch';
getPeachBlossom('午'); // → '卯' (fire group)

華蓋 Canopy ​

The "tomb" position of the 三合 group. Associated with artistic temperament, solitude, and spiritual inclination.

typescript
import { getCanopy } from 'stem-branch';
getCanopy('子'); // → '辰' (water group)

將星 General Star ​

The "emperor" position — peak power of the 三合 element. Leadership and authority.

typescript
import { getGeneralStar } from 'stem-branch';
getGeneralStar('寅'); // → '午' (fire group)

劫煞 Robbery Star ​

The "extinction" position. Sudden, unexpected loss or danger.

typescript
import { getRobberyStar } from 'stem-branch';
getRobberyStar('酉'); // → '寅' (metal group)

亡神 Death Spirit ​

Hidden harm position. Subtle, hard-to-detect negative influence.

typescript
import { getDeathSpirit } from 'stem-branch';
getDeathSpirit('卯'); // → '寅' (wood group)

Year Branch Stars 年支取煞 ​

紅鸞 Red Phoenix ​

Formula: (3 - yearBranchIndex + 12) % 12

Year Branch子丑寅卯辰巳午未申酉戌亥
紅鸞卯寅丑子亥戌酉申未午巳辰

Marriage and romantic fortune. Activated when any pillar branch matches.

天喜 Heavenly Joy ​

Formula: 紅鸞 + 6 (opposite position on the branch circle)

Year Branch子丑寅卯辰巳午未申酉戌亥
天喜酉申未午巳辰卯寅丑子亥戌

Joyful events, celebrations.

天醫 Heavenly Doctor ​

Formula: year branch + 1 (next branch)

Year Branch子丑寅卯辰巳午未申酉戌亥
天醫丑寅卯辰巳午未申酉戌亥子

Healing ability, medical aptitude.

孤辰 Lonely Star ​

Derived from the seasonal group of the year branch.

Seasonal GroupBranches孤辰
Spring 春寅卯辰巳
Summer 夏巳午未申
Autumn 秋申酉戌亥
Winter 冬亥子丑寅

Loneliness, independence. More significant for males.

寡宿 Widow Star ​

Seasonal GroupBranches寡宿
Spring 春寅卯辰丑
Summer 夏巳午未辰
Autumn 秋申酉戌未
Winter 冬亥子丑戌

Solitude, isolation. More significant for females.


Day Pillar Predicates 日柱取煞 ​

These stars are determined by the specific day pillar (stem + branch combination). No external lookup — the day pillar itself either is or is not in the predefined set.

魁罡 Commanding Star ​

Set: 壬辰, 庚戌, 庚辰, 戊戌

Strong, decisive personality. Only four day pillars carry this star.

十惡大敗 Ten Evils ​

Set: 甲辰, 乙巳, 壬申, 丙申, 丁亥, 庚辰, 戊戌, 癸亥, 辛巳, 己丑

Days considered extremely inauspicious. These are the 10 day pillars where the 祿 (prosperity star) is in the 空亡 (void) position.

陰差陽錯 Yin-Yang Error ​

Set: 丙子, 丙午, 丁丑, 丁未, 戊寅, 戊申, 辛卯, 辛酉, 壬辰, 壬戌, 癸巳, 癸亥

Day pillars where yin and yang energies are misaligned. Considered inauspicious for marriage.

金神 Gold Spirit ​

Set: 己巳, 癸酉, 乙丑

Day pillars with concentrated metal energy. Auspicious — indicates determination and resilience.

十靈日 Ten Spirits ​

Set: 甲辰, 乙亥, 丙辰, 丁酉, 戊午, 庚戌, 庚寅, 辛亥, 壬寅, 癸未

Day pillars associated with spiritual sensitivity and intuition.

天羅 Heaven Net ​

Branches: 戌, 亥

Entrapment for fire-element people. When the day branch is 戌 or 亥.

地網 Earth Trap ​

Branches: 辰, 巳

Entrapment for water-element people. When the day branch is 辰 or 巳.


Calendar Predicates 曆法取煞 ​

These depend on relationships between pillars, or between the day pillar and the current season.

月破 Month Break ​

The day branch clashes (六衝) with the month branch. The six clashes are:

子↔午, 丑↔未, 寅↔申, 卯↔酉, 辰↔戌, 巳↔亥

歲破 Year Break ​

The day branch clashes with the year branch. Same clash pairs as above.

天赦日 Heaven's Pardon ​

One of the most auspicious days. Determined by season + day pillar:

SeasonRequired Day Pillar
Spring 春戊寅
Summer 夏甲午
Autumn 秋戊申
Winter 冬甲子

Only occurs when the day pillar exactly matches the season's designated pillar.

四廢 Four Waste ​

Day pillars whose element is in the "dead" phase during the current season:

SeasonWaste PillarsElementReason
Spring 春庚申, 辛酉Metal 金Metal is dead in spring (wood season)
Summer 夏壬子, 癸亥Water 水Water is dead in summer (fire season)
Autumn 秋甲寅, 乙卯Wood 木Wood is dead in autumn (metal season)
Winter 冬丙午, 丁巳Fire 火Fire is dead in winter (water season)

三奇貴人 Three Wonders ​

Activated when three consecutive pillar stems form a special pattern:

PatternTypeStems
天上三奇Heaven乙丙丁
地上三奇Earth甲戊庚
人中三奇Human壬癸辛

Checks year-month-day and month-day-hour stem sequences.


API ​

typescript
import {
  getAlmanacFlags,          // Date → all active flags
  getAlmanacFlagsForPillars, // FourPillars + season → all active flags
  getHeavenlyNoble,         // Stem → [Branch, Branch]
  getSupremeNoble,          // Stem → Branch[]
  getLiteraryStar,          // Stem → Branch
  getProsperityStar,        // Stem → Branch
  getRamBlade,              // Stem → Branch
  getGoldenCarriage,        // Stem → Branch
  getStudyHall,             // Stem → Branch
  getTravelingHorse,        // Branch → Branch
  getPeachBlossom,          // Branch → Branch
  getCanopy,                // Branch → Branch
  getGeneralStar,           // Branch → Branch
  getRobberyStar,           // Branch → Branch
  getDeathSpirit,           // Branch → Branch
  getRedPhoenix,            // Branch → Branch
  getHeavenlyJoy,           // Branch → Branch
  getHeavenlyDoctor,        // Branch → Branch
  getLonelyStar,            // Branch → Branch
  getWidowStar,             // Branch → Branch
  isCommandingStar,         // (Stem, Branch) → boolean
  isTenEvils,               // (Stem, Branch) → boolean
  isYinYangError,           // (Stem, Branch) → boolean
  isGoldSpirit,             // (Stem, Branch) → boolean
  isTenSpirits,             // (Stem, Branch) → boolean
  isHeavenNet,              // Branch → boolean
  isEarthTrap,              // Branch → boolean
  isHeavensPardon,          // (Stem, Branch, season) → boolean
  isMonthBreak,             // (Branch, Branch) → boolean
  isYearBreak,              // (Branch, Branch) → boolean
  isFourWaste,              // (Stem, Branch, season) → boolean
  getThreeWonders,          // FourPillars → 'heaven'|'earth'|'human'|null
} from 'stem-branch';

See Also ​