Years to Seconds Converter
Convert years to seconds — a Gregorian year is exactly 31,556,952 seconds.
Updated
seconds
31,556,952s
1 yr = 31,556,952 s
In short
How many seconds are in a year?
A Gregorian year is exactly 31,556,952 seconds, from 365.2425 days of 86,400 each. Most software uses 31,536,000 instead, which is a flat 365-day year. The gap is 20,952 seconds — about five hours and forty-nine minutes — and it is the leap day averaged out.
A one-year cache lifetime is conventionally written as 31,536,000 seconds, not the Gregorian figure.
years to seconds — quick reference
| years (yr) | seconds (s) |
|---|---|
| 0.5 yr | 15,778,476 s |
| 1 yr | 31,556,952 s |
| 2 yr | 63,113,904 s |
| 5 yr | 157,784,760 s |
| 10 yr | 315,569,520 s |
| 18 yr | 568,025,136 s |
| 25 yr | 788,923,800 s |
| 50 yr | 1,577,847,600 s |
The formula, worked line by line
Two exact chains meet. A day is 86,400 seconds, from 24 hours of 60 minutes of 60 seconds, every step a whole-number ratio inherited from Babylonian arithmetic. A Gregorian year averages 365.2425 days, because the leap rule adds a day every four years, withholds it in century years, and restores it in years divisible by four hundred.
“Every year divisible by 4 is a leap year, except years divisible by 100, unless they are also divisible by 400.”
Over 400 years that rule yields exactly 146,097 days. Divide by 400 for the mean year, multiply by 86,400, and the answer lands on 31,556,952 with nothing after the decimal point.
seconds = years x 31,556,952
31,556,952 = 365.2425 x 86,400
86,400 = 24 x 60 x 60
1 year -> 1 x 31,556,952 = 31,556,952 s
flat 365-day year = 31,536,000 s- Years entered
- 1
- Days that is
- 365.2425
- Times 86,400
- 365.2425 x 86,400 = 31,556,952
- Seconds
- 31,556,952
The flat 365-day year gives 31,536,000, which is 20,952 seconds less — five hours and forty-nine minutes. That quantity is the leap day divided across four years, which is precisely what the 0.2425 in the mean year represents.
Where the extra 20,952 seconds comes from
A leap day is 86,400 seconds and the Gregorian calendar adds 97 of them every 400 years. Spread that across the 400 years and each one gains 0.2425 of a day, which is 20,952 seconds. So the gap between the flat year and the mean year is not an approximation — it is the leap rule, expressed per year.
- Leap days per 400 years
- 97, not 100
- That in seconds
- 8,380,800
- Divided across 400 years
- 20,952 s per year
- Flat year plus that
- 31,536,000 + 20,952 = 31,556,952
Ninety-seven rather than a hundred because three century years in every four skip their leap day. That is the whole difference between the Gregorian and Julian calendars.
A note on leap seconds
These are a separate thing from leap days and do not appear here. Twenty-seven have been inserted into UTC since 1972, but POSIX timestamps omit them by defining every day as exactly 86,400 seconds. A year in seconds is therefore a calendar quantity, not a measurement of elapsed physical time.
How to use the years to seconds converter
A day is exactly 86,400 seconds and a Gregorian year averages 365.2425 days, so one year is exactly 31,556,952 seconds. The multiplication produces a whole number, which is a coincidence of the arithmetic rather than a design choice, and it makes this one of the tidier calendar conversions.
The usual reason to run it is configuration. Cache lifetimes, token expiries, cookie ages, retention windows and certificate validity are all set in seconds, and the human wanting them thinks in years. Somewhere between the two, a decision gets made about how long a year is.
31,556,952
One Gregorian year
365.2425 x 86,400
31,536,000
One flat 365-day year
what most software means
20,952 s
The gap between them
about 5 h 49 min
Software almost always picks the flat 365-day year. A max-age of one year in an HTTP cache header is conventionally 31,536,000, and a great deal of tooling repeats that figure. It is not wrong; it is a different definition, chosen because it needs no leap-year reasoning.
The other constraint is the field. A signed 32-bit integer holds 2,147,483,647, which is 68.05 years of seconds. Any expiry longer than that overflows, which is the same limit that gives Unix time its 2038 deadline and which still catches people setting far-future cookie ages.
- 1 day
- 86,400 s
- 30 days
- 2,592,000 s
- 1 year, flat 365 days
- 31,536,000 s
- 1 year, Gregorian
- 31,556,952 s
- 10 years
- 315,569,520 s
- Signed 32-bit maximum
- 2,147,483,647 s, 68.05 years
The last row is a ceiling rather than a duration. Anything above it needs a 64-bit field, which current POSIX already requires.
Reading a timestamp rather than setting one
A span in seconds and a point in time are different things. That page turns a Unix timestamp into a readable date and back, in seconds or milliseconds.
Open the timestamp converter →Years converted to seconds on the Gregorian mean year, with the flat 365-day figure alongside. The third column is what most software would use for the same span.
| Years | Seconds, Gregorian | Seconds, flat 365-day |
|---|---|---|
| 0.25 years | 7,889,238 | 7,884,000 |
| 0.5 years | 15,778,476 | 15,768,000 |
| 1 year | 31,556,952 | 31,536,000 |
| 2 years | 63,113,904 | 63,072,000 |
| 3 years | 94,670,856 | 94,608,000 |
| 5 years | 157,784,760 | 157,680,000 |
| 10 years | 315,569,520 | 315,360,000 |
| 18 years | 568,025,136 | 567,648,000 |
| 20 years | 631,139,040 | 630,720,000 |
| 25 years | 788,923,800 | 788,400,000 |
| 30 years | 946,708,560 | 946,080,000 |
| 50 years | 1,577,847,600 | 1,576,800,000 |
| 100 years | 3,155,695,200 | 3,153,600,000 |
Which year a system means
There is no standard second-count for a year, which surprises people who expect one. The Gregorian mean of 31,556,952 is the calendar's true long-run average. The flat 365-day year of 31,536,000 is what most configuration files contain. Both are defensible and they differ by nearly six hours.
The flat year won in software for a practical reason: it needs no calendar logic. A duration measured in fixed seconds cannot know whether a leap day falls inside it, so building the average into the constant is a way of pretending the question never arises.
- Flat 365-day year
- max-age=31536000
- Gregorian mean year
- max-age=31556952
- Difference
- 20,952 seconds, 5 h 49 min
- Practical effect on a cache
- none whatsoever
- What to write
- whatever the codebase already uses
For a cache lifetime the distinction is meaningless — nothing depends on the last six hours of a year-long window. It stops being meaningless when the value is a legal retention period, a certificate lifetime or a billing boundary, where the exact expiry instant has consequences.
The rule that keeps things sane is to pick one convention per system and write it down. Discrepancies here are rarely bugs on their own; they become bugs when two components compute the same deadline differently and drift apart by a few hours.
The ceiling on a second count
A signed 32-bit integer runs to 2,147,483,647. As a duration that is 68.05 years, and as a Unix timestamp it is 19 January 2038 at 03:14:07 UTC. The next second needs one more than the field can hold, and the value wraps into negative territory reading as 1901.
Current POSIX has already addressed this: the 2024 edition requires time_t to be at least 64 bits in conforming programming environments, which moves the ceiling out of any practical range. The exposure is in what already exists — firmware, file formats, database columns and protocols that fixed the width years ago.
- Signed 32-bit maximum
- 2,147,483,647 s
- That as a duration
- 68.05 years
- That as a timestamp
- 19 January 2038, 03:14:07 UTC
- Signed 64-bit maximum
- far beyond any practical horizon
Sixty-eight years is the whole runway a 32-bit second counter ever had. Starting it at 1970 is what set the deadline.
Practically, any expiry beyond about 2038 set in a 32-bit field will not do what it says. Certificate lifetimes, far-future cookie ages and "never expire" values implemented as a very large second count are the common places this shows up, and the failure is silent rather than loud.
Every years value, worked out
61 common years figures each get their own page, with the answer, the arithmetic, what rounding costs, and the nearest real-world reference point on the scale.
Questions people ask
Sources
Where the constants and formulas on this page come from. Each line names the figure it backs.
The Gregorian leap rule produces exactly 146,097 days per 400 years, giving a mean year of 365.2425 days and therefore 31,556,952 seconds.
Calendars — Explanatory Supplement to the Astronomical Almanac — US Naval Observatory
POSIX computes seconds since the Epoch with every day taken as exactly 86,400 seconds, and requires time_t to be at least 64 bits in conforming programming environments.
IEEE Std 1003.1-2024 (POSIX.1-2024), Base Definitions and Rationale — The Open Group and IEEE, 2024
Related guides
Putting JSON in a URL: Validate, Minify, Percent-Encode, or Base64url?
A decision guide for flattening, encoding, checking, and safely transporting JSON in a query string.
August 11, 2026 · 9 min read
How Many Grams in a Cup? Every Ingredient, One Chart
One formula, fourteen densities. Why flour is 120 g, honey is 340 g, and the ingredient — not the cup — decides the number.
August 10, 2026 · 14 min read
How Are Loan Payments Calculated? Amortization, Explained
One level payment, front-loaded interest — the formula worked by hand, the two levers you control, and why the smaller payment is often the costlier loan.
July 23, 2026 · 13 min read