function calculateZodiac() {
var year = document.getElementById("birthYear").value;
var resultDiv = document.getElementById("zodiacResult");
if (!year || year 2100) {
alert("Please enter a valid year between 1900 and 2100");
return;
}
var signs = [
{ name: "Rat", traits: "Quick-witted, resourceful, versatile, and kind.", lucky: "2, 3" },
{ name: "Ox", traits: "Diligent, dependable, strong, and determined.", lucky: "1, 4" },
{ name: "Tiger", traits: "Brave, confident, competitive, and unpredictable.", lucky: "1, 3, 4" },
{ name: "Rabbit", traits: "Quiet, elegant, kind, and responsible.", lucky: "3, 4, 6" },
{ name: "Dragon", traits: "Confident, intelligent, and enthusiastic.", lucky: "1, 6, 7" },
{ name: "Snake", traits: "Enigmatic, intelligent, and wise.", lucky: "2, 8, 9" },
{ name: "Horse", traits: "Animated, active, and energetic.", lucky: "2, 3, 7" },
{ name: "Goat", traits: "Gentle, shy, stable, and sympathetic.", lucky: "2, 7" },
{ name: "Monkey", traits: "Sharp, smart, and curious.", lucky: "4, 9" },
{ name: "Rooster", traits: "Observant, hardworking, and courageous.", lucky: "5, 7, 8" },
{ name: "Dog", traits: "Lovely, honest, and prudent.", lucky: "3, 4, 9" },
{ name: "Pig", traits: "Compassionate, generous, and diligent.", lucky: "2, 5, 8" }
];
var elements = ["Metal", "Metal", "Water", "Water", "Wood", "Wood", "Fire", "Fire", "Earth", "Earth"];
// The cycle starts with Rat at 1900
var signIndex = (year – 1900) % 12;
// Handle potential negative result if user enters year < 1900 (though validation prevents it)
if (signIndex < 0) signIndex += 12;
var elementIndex = year % 10;
var userSign = signs[signIndex];
var userElement = elements[elementIndex];
document.getElementById("resSign").innerText = userSign.name;
document.getElementById("resElement").innerText = userElement;
document.getElementById("resTraits").innerText = userSign.traits;
document.getElementById("resLucky").innerText = userSign.lucky;
resultDiv.style.display = "block";
}
Understand Your Chinese Horoscope: The 12-Year Cycle
The Chinese Horoscope, or Shengxiao, is based on a twelve-year cycle where each year is represented by a specific animal. Unlike Western astrology, which is based on months, Chinese astrology is primarily determined by the year you were born. Use our Chinese Horoscope Calculator above to find your animal sign and the governing element for your birth year.
The 12 Animal Signs and Their Meaning
Each animal in the Chinese zodiac carries specific personality traits and influences the destiny of those born under its sign. Here is a breakdown of the twelve signs:
Rat: Known for wisdom and adaptability.
Ox: Symbolizes reliability and steady strength.
Tiger: Represents courage and leadership.
Rabbit: Characterized by gentleness and sensitivity.
Dragon: A symbol of power, luck, and authority.
Snake: Associated with intuition and mystery.
Horse: Known for freedom and high energy.
Goat: Represents creativity and peace-loving nature.
Monkey: Symbolizes cleverness and innovation.
Rooster: Known for punctuality and fidelity.
Dog: The ultimate symbol of loyalty and honesty.
Pig: Represents abundance and a happy-go-lucky nature.
The Five Elements in Chinese Astrology
In addition to the 12 animals, the Chinese Horoscope incorporates the five elements: Wood, Fire, Earth, Metal, and Water. Your element is determined by the last digit of your birth year:
Last Digit of Year
Element
Core Characteristic
0 or 1
Metal
Persistence and Strength
2 or 3
Water
Communication and Intuition
4 or 5
Wood
Growth and Vitality
6 or 7
Fire
Passion and Dynamism
8 or 9
Earth
Stability and Practicality
Example Calculation
If you were born in 1988:
Animal Sign: (1988 – 1900) % 12 = 88 % 12 = Remainder 4. The 4th index (starting from 0 as Rat) is the Dragon.
Element: The last digit is 8, which corresponds to the Earth element.
Combined: You are an Earth Dragon, known for being ambitious but more grounded and level-headed than other Dragons.
Why Use a Chinese Horoscope Calculator?
Knowing your Chinese sign provides deeper insights into your personality, compatibility with others, and potential fortune for the coming year. In many East Asian cultures, the zodiac is still used to determine everything from business partnerships to marriage compatibility. Whether you are a Fire Tiger or a Metal Rooster, your sign offers a unique blueprint for your character.