Four Pillars chart generator
Enter a birth date and time and get the full BaZi chart: the four pillars, hidden stems, ten gods, five-element balance and luck pillars. It runs entirely in your browser.
Everything is calculated in your browser, including the image export. Nothing you enter is sent anywhere, saved, or put in the address bar. Reloading the page clears it. More information below covers the method and its limits.
More information
A Four Pillars (BaZi, "eight characters") chart turns a birth date and time into four stem-and-branch pairs, one each for the year, month, day and hour. This section explains what the generator shows, how it gets there, and where results can differ from other tools.
How to read the chart
- Pillars. Each card is one pillar: stem on top, branch below, and the hidden stems that live inside the branch at the bottom. Characters are colored by element.
- Day master. The day stem stands for the person. The outlined card is the day pillar, and every other stem is labeled by its relationship to it (the ten gods, below).
- Five elements. A first-pass count of the visible stems plus the main element of each branch. It does not weigh the season of the month or the hidden stems, which practitioners usually do.
- Luck pillars. Ten-year periods that follow the month pillar forward or backward in the 60-pair cycle. Direction depends on the polarity of the birth year and the gender entered, and the start age comes from counting days to the nearest solar term (three days is one year).
- Weighted elements. A second way to count the elements that gives hidden stems and the month more say (the exact convention is below), plus how strong each element is in the month's season: 旺 prosperous, 相 strengthening, 休 resting, 囚 confined, 死 dormant.
- Annual and monthly pillars. Pick a year to see its annual pillar and the twelve monthly pillars, each labeled by its ten-god relationship to your day master.
- Compare. Tick "Compare with a second person" to see two charts together, each with its elements and luck pillars, and how their day masters, day stems and branches pair up.
- Save. Download the chart as an SVG or a PNG. The image leaves out the birth date and time unless you tick the box.
The building blocks
Ten heavenly stems and twelve earthly branches pair up in a repeating cycle of sixty. Each carries an element, and stems also carry a polarity.
| Stems | Element | Polarity |
|---|---|---|
| 甲 乙 | Wood | yang, yin |
| 丙 丁 | Fire | yang, yin |
| 戊 己 | Earth | yang, yin |
| 庚 辛 | Metal | yang, yin |
| 壬 癸 | Water | yang, yin |
| Branch | Animal | Element | Hours | Hidden stems |
|---|---|---|---|---|
| 子 | Rat | Water | 23:00–01:00 | 癸 |
| 丑 | Ox | Earth | 01:00–03:00 | 己 癸 辛 |
| 寅 | Tiger | Wood | 03:00–05:00 | 甲 丙 戊 |
| 卯 | Rabbit | Wood | 05:00–07:00 | 乙 |
| 辰 | Dragon | Earth | 07:00–09:00 | 戊 乙 癸 |
| 巳 | Snake | Fire | 09:00–11:00 | 丙 庚 戊 |
| 午 | Horse | Fire | 11:00–13:00 | 丁 己 |
| 未 | Goat | Earth | 13:00–15:00 | 己 丁 乙 |
| 申 | Monkey | Metal | 15:00–17:00 | 庚 壬 戊 |
| 酉 | Rooster | Metal | 17:00–19:00 | 辛 |
| 戌 | Dog | Earth | 19:00–21:00 | 戊 辛 丁 |
| 亥 | Pig | Water | 21:00–23:00 | 壬 甲 |
The branches also mark the twelve two-hour blocks of the day. The generator uses the hours in the table, in local clock time.
The ten gods
Relative to the day master, every other stem is one of five relationships, split by whether its polarity matches. The card labels come from this table.
| Relationship to the day master | Same polarity | Opposite polarity |
|---|---|---|
| Same element | Friend 比肩 | Rob Wealth 劫财 |
| Element the day master produces | Eating God 食神 | Hurting Officer 伤官 |
| Element the day master controls | Indirect Wealth 偏财 | Direct Wealth 正财 |
| Element that controls the day master | Seven Killings 七杀 | Direct Officer 正官 |
| Element that produces the day master | Indirect Resource 偏印 | Direct Resource 正印 |
How it is calculated
Calendar logic with solar terms is easy to get subtly wrong, so the generator does not hand-roll it. It uses the open-source lunar-javascript library (MIT license, bundled with this site) for the pillars, hidden stems, ten gods and luck pillars, and adds the element counts, the boundary warnings and the drawing on top.
I tested the port against reference data from the Python sibling, lunar-python: 824 charts (random dates from 1901 to 2099, month and year boundaries at the exact minute of each solar term, and the edges of the two-hour blocks around 23:00), 320 late-Zi births under both conventions, the annual and monthly pillars for 14 sample years, and the full ten-gods table. Every field matches. I also spot-checked the equation of time against published values and tested the solar-time arithmetic, including crossing midnight and New Year.
Those libraries share an author and a method (the Shouxing astronomical algorithm), so agreement between them shows the port is faithful, not that the method is right. To check the method itself I added a test that shares neither. It computes the moment the Sun's apparent ecliptic longitude reaches each multiple of 15 degrees straight from NASA's JPL DE440s planetary ephemeris, using Skyfield, and recomputes the pillars from first principles: the day pillar from a Julian-day formula, the hour pillar from the "five rats" rule, the month stem from the "five tigers" rule, and the year and month changes from those solar terms. For 1901 to 2050, all 1,800 month-starting solar terms agree with the calendar tables to within 45 seconds (usually within a couple), and tens of thousands of random and boundary instants give the same pillars. The only differences are minutes that fall inside those few seconds of disagreement, which is why a birth within a minute or two of a solar term can come out differently in different tools. Another implementation of the Shouxing method, sxtwl, agrees with the library to within 55 seconds.
Conventions I chose
- Weighted elements. Each stem counts 1. Each branch counts 1, split across its hidden stems (main, middle and residual at 60/30/10, or 70/30 when there are two, or all to the main one), and the month branch counts double. This is one simple way to show the month's pull, not a standard scoring system, so the simple count is shown alongside.
- Season strength. The month branch gives the season's element, and each element is rated against it by the classical cycle: the season's own element is prosperous, the one it produces is strengthening, the one that produces it is resting, the one that controls it is confined, and the one it controls is dormant. Earth months (辰 戌 丑 未) are treated as earth seasons.
- Annual and monthly pillars. The annual pillar starts at lichun and each monthly pillar at a solar term, both to the minute.
- Compare. The pairings shown are the six harmonies (子丑, 寅亥, 卯戌, 辰酉, 巳申, 午未), the six clashes (子午, 丑未, 寅申, 卯酉, 辰戌, 巳亥) and the five heavenly-stem combinations (甲己, 乙庚, 丙辛, 丁壬, 戊癸). Nothing is scored.
Where results can differ
- Year and month boundaries. The year changes at the start of spring (about 4 February) and the month at each solar term, to the minute. If you were born close to one, the page warns you. Check such charts against a second tool.
- The late Zi hour (23:00–23:59). Schools differ on whether those minutes belong to the day before midnight or the next day. The default here keeps the same day pillar; "More options" lets you use the next day's pillar instead. Either way the hour pillar is the same, and the page flags births in that hour.
- Local solar time. Some practitioners adjust the birth time to the true solar time of the birthplace. By default this generator uses the clock time you enter. Open "Adjust to local solar time" to shift it by your longitude, daylight saving and the equation of time. You can fill the longitude and the clock offset from a list of about thirty cities, but the offsets listed are today's standard time. Time zones and daylight saving rules have changed over the years and I don't guess them, so check what applied on the birth date and tick daylight saving if it did. Practitioners differ on whether to include the equation of time, so it has its own checkbox.
- Unknown birth time. The hour pillar is left out and the luck-pillar start age is approximate.
- Dates after 2050. The exact minute of a solar term depends on how much Earth's rotation will have slowed, which isn't known yet. The calendar tables drift from the ephemeris by up to about two minutes by the 2090s, so a chart for a future date is less certain close to a month or year boundary.
- Range. Dates from 1901 to 2099 (annual and monthly pillars for 1901 to 2098).
What this is not
I treat Four Pillars as a traditional, rule-based system that is worth understanding, not as a forecast. This page does the calculation and the labeling. It does not interpret the chart or predict anything.
Privacy
The page's scripts make no network requests with what you type, set no cookies and use no browser storage. Image export happens in your browser too. The birth date is never added to the address bar, so a link or bookmark to this page never contains it. The site's web server logs ordinary page requests, as any server does, but your inputs are never part of them because they stay in the page.
Credits
Calendar and BaZi calculations by lunar-javascript by 6tail (MIT). Chart drawing, element counting, solar-time adjustment, comparison, export and this page were built with Claude. The step-by-step write-up walks through the same chart for a fictional sample person and how the first version was built.