Age Calculator

Age Calculator API

Utilities

Find your exact age in years, months and days from your date of birth, plus total weeks, days and hours, the day you were born and a countdown to your next birthday.

Authentication

Send your API key as a Bearer token in the Authorization header (Authorization: Bearer YOUR_API_KEY), or in an X-API-Key header.

Rate Limit

120 requests per minute

Endpoints

2 endpoints available

Overview

Works out exact age in years, months and days from a date of birth, plus total months, weeks, days and hours, the weekday of birth, the next birthday and the next 1,000-day milestone.

Dates and time zones

  • Dates are plain calendar dates written YYYY-MM-DD (years 0001 to 9999). They have no time zone, so a date never shifts.
  • If you leave out asOf, the age is measured to today's date in UTC on the server. The date that was used comes back as asOf. Send asOf yourself for results that do not change from day to day.
  • Month-end dates are clamped: one month after January 31 is the last day of February.
  • People born on February 29 can have their common-year birthday counted on February 28 (feb28, the default) or March 1 (mar1).
  • totalHours is whole days times 24, counted from midnight. It does not use a time of birth.

Response

age (years, months, days), totalMonths, totalWeeks, weekRemainderDays, totalDays, totalHours, bornOnWeekday, nextBirthday (date, weekday, turning, daysUntil, isToday, countdown) and nextMilestone (daysOld, date, daysUntil). All numbers are numbers. A date after 9999-12-31 comes back as null.

Endpoints

POST
https://opentools.ca/api/v1/tools/age-calculator
Calculate exact age from a date of birth

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
birthDate
string
Required
Date of birth, YYYY-MM-DD.
asOf
string
OptionalDate to measure the age on, YYYY-MM-DD. Must not be before birthDate. Defaults to today's date in UTC on the server.Default: today (UTC)
leapDayRule
string
Enum: feb28, mar1
OptionalFor a February 29 birthday: count it on February 28 or March 1 in years with no February 29.Default: feb28

Response Example

{
  "success": true,
  "birthDate": "1990-05-17",
  "asOf": "2026-11-25",
  "leapDayRule": "feb28",
  "age": {
    "years": 36,
    "months": 6,
    "days": 8
  },
  "totalMonths": 438,
  "totalWeeks": 1905,
  "weekRemainderDays": 6,
  "totalDays": 13341,
  "totalHours": 320184,
  "bornOnWeekday": "Thursday",
  "nextBirthday": {
    "date": "2027-05-17",
    "weekday": "Monday",
    "turning": 37,
    "daysUntil": 173,
    "isToday": false,
    "countdown": {
      "years": 0,
      "months": 5,
      "days": 22
    }
  },
  "nextMilestone": {
    "daysOld": 14000,
    "date": "2028-09-14",
    "daysUntil": 659
  }
}

Error Codes

400
Bad Request - birthDate or asOf is not a real YYYY-MM-DD date, or birthDate is after asOf
401
Unauthorized - Missing or invalid API key
403
Forbidden - The API key is inactive or expired, or the request IP is not allowed
405
Method Not Allowed - This endpoint accepts GET and POST only
429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)
500
Internal Server Error
GET
https://opentools.ca/api/v1/tools/age-calculator
Calculate exact age from a date of birth. Same fields as the POST body, sent as query parameters.

Query Parameters

ParameterTypeRequiredDescription
birthDate
string
Required
Date of birth, YYYY-MM-DD.
asOf
string
OptionalDate to measure the age on, YYYY-MM-DD. Must not be before birthDate. Defaults to today's date in UTC on the server.Default: today (UTC)
leapDayRule
string
Enum: feb28, mar1
OptionalFor a February 29 birthday: count it on February 28 or March 1 in years with no February 29.Default: feb28

Response Example

{
  "success": true,
  "birthDate": "1990-05-17",
  "asOf": "2026-11-25",
  "leapDayRule": "feb28",
  "age": {
    "years": 36,
    "months": 6,
    "days": 8
  },
  "totalMonths": 438,
  "totalWeeks": 1905,
  "weekRemainderDays": 6,
  "totalDays": 13341,
  "totalHours": 320184,
  "bornOnWeekday": "Thursday",
  "nextBirthday": {
    "date": "2027-05-17",
    "weekday": "Monday",
    "turning": 37,
    "daysUntil": 173,
    "isToday": false,
    "countdown": {
      "years": 0,
      "months": 5,
      "days": 22
    }
  },
  "nextMilestone": {
    "daysOld": 14000,
    "date": "2028-09-14",
    "daysUntil": 659
  }
}

Error Codes

400
Bad Request - birthDate or asOf is not a real YYYY-MM-DD date, or birthDate is after asOf
401
Unauthorized - Missing or invalid API key
403
Forbidden - The API key is inactive or expired, or the request IP is not allowed
405
Method Not Allowed - This endpoint accepts GET and POST only
429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)
500
Internal Server Error

Code Examples

# Age on a given date
curl -X POST https://opentools.ca/api/v1/tools/age-calculator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "birthDate": "1990-05-17",
  "asOf": "2026-11-25"
}'

# Leap day birthday counted on March 1
curl -X POST https://opentools.ca/api/v1/tools/age-calculator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "birthDate": "2000-02-29",
  "asOf": "2026-02-28",
  "leapDayRule": "mar1"
}'

# The same request as a GET with query parameters
curl "https://opentools.ca/api/v1/tools/age-calculator?birthDate=1990-05-17&asOf=2026-11-25" \
  -H "Authorization: Bearer YOUR_API_KEY"

Ready to get started?

Create an API key to start using the Age Calculator API.

Rather use it in your browser? Open the Age Calculator