Age Calculator Formula
Understand the math behind the age calculator. Each variable explained with a worked example.
Formulas Used
Age in Years
age_years = floor(total_months / 12)Additional Months
age_months_remainder = total_months - floor(total_months / 12) * 12Total Months Lived
total_months_lived = total_monthsVariables
| Variable | Description | Default |
|---|---|---|
birth_year | Birth Year | 1990 |
birth_month | Birth Month (1-12) | 6 |
current_year | Current Year | 2026 |
current_month | Current Month (1-12) | 3 |
total_months | Derived value= (current_year - birth_year) * 12 + (current_month - birth_month) | calculated |
How It Works
How to Calculate Age
Subtract your birth date from the current date, counting full years and remaining months.
Formula
Total Months = (Current Year - Birth Year) x 12 + (Current Month - Birth Month)
Age in Years = floor(Total Months / 12)
Worked Example
Born June 1990, current date March 2026.
birth_year = 1990birth_month = 6current_year = 2026current_month = 3
- 01Total months = (2026 - 1990) x 12 + (3 - 6) = 432 - 3 = 429
- 02Age in years = floor(429 / 12) = 35
- 03Remaining months = 429 - 35 x 12 = 9
- 04You are 35 years and 9 months old
Ready to run the numbers?
Open Age Calculator