Age gating is everywhere: COPPA, GDPR digital-consent rules, alcohol and gambling laws, and content ratings all hinge on a user’s exact age. This tool does the calendar-correct age math from a date of birth and then checks it against the common legal thresholds (13, 16, 18, 21), showing a clear pass or fail and how many days remain until the next milestone. It is built for developers wiring up age-gate logic and for compliance teams who need a quick, accurate check.
How it works
Naive age math (subtracting years) is wrong around birthdays and leap years. This tool uses proper calendar arithmetic:
- Take the birth date and the as-of date (today by default).
- Compute
years = asOf.year - dob.year. If the as-of month/day is before the birth month/day, subtract 1 (the birthday has not happened yet this year). - Compute the leftover months and days by borrowing: if the day-of-month is short, borrow days from the previous month using that month’s real length; if months go negative, borrow 12 months and decrement years.
This yields an exact years / months / days breakdown that respects leap years and the differing lengths of each month.
The thresholds
| Threshold | Typical legal basis |
|---|---|
| 13 | COPPA (US children’s online privacy) |
| 16 | GDPR digital consent (default; some states use 13-15) |
| 18 | Adulthood, gambling, contracts, most alcohol |
| 21 | US alcohol purchase |
For each, the tool shows whether the computed age meets or exceeds it, and if not, the number of days until it will.
Example
A date of birth of 1 March 2008 checked as of 6 June 2026 yields 18 years, 3 months, 5 days. That passes the 13, 16, and 18 gates and fails the 21 gate, with the days-to-21 countdown shown alongside.
Notes
This is age math, not identity verification — it trusts the date you enter. In production, combine it with a verified source of date of birth. Everything runs locally; nothing you type leaves your browser.