Chinese Zodiac Calculator
Fun and interactive. Enter a birth year to instantly discover the corresponding animal sign from the 12-year Chinese Zodiac cycle.
Copy the Script
<script>
function getZodiac() {
var year = document.getElementById('year').value;
var animals = ["Monkey", "Rooster", "Dog", "Pig", "Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat"];
if (year < 1900) {
alert("Please enter a valid year.");
return;
}
// 1900 was Year of the Rat.
// The array above is offset to match year % 12 logic directly.
var remainder = year % 12;
alert("Your sign is: " + animals[remainder]);
}
</script>
<input type="text" id="year">
<button onclick="getZodiac()">Check</button>
Frequently Asked Questions
The Chinese Zodiac follows a 12-year cycle. By taking the birth year and using the modulo operator (`year % 12`), we get a remainder (0-11) which corresponds to a specific animal in an array.
It is accurate for the year broadly. However, the Chinese New Year changes date annually (Jan/Feb). Someone born in Jan 1990 might technically belong to the previous year's sign. This simple script assumes the solar year.
Yes. You can have an array of image filenames matching the animal names and update an `
` src attribute dynamically.