How to use the duration humanizer
- Type the number into Duration. Decimals and negative numbers are allowed.
- Choose the Unit: Milliseconds, Seconds, Minutes, Hours or Days.
- Read the four formats at the top: Compact, Long, ISO 8601 and Clock.
- Use the Total in each unit table for the same span as one number in each unit, and the Breakdown row for days, hours, minutes, seconds and milliseconds.
What it does and when to use it
Logs, metrics and APIs report time as raw numbers, such as "elapsed_ms": 93784000 or an uptime in seconds. This tool turns them into something a person can read, and into formats that code and config expect. For example, ISO 8601 durations appear in YouTube’s API, XML Schema and many scheduling systems, and hh:mm:ss suits video lengths and timers.
Common uses are reading a job’s runtime from a log, setting a timeout or cache TTL (how many seconds is 2.5 hours?), and writing a PT… value into a config file.
To measure the time between two dates, use the timestamp diff calculator. To turn a Unix timestamp into a date, use the Unix timestamp converter. For sizes in bytes, the bytes humanizer does the same job.
How it works
The value is converted to milliseconds (seconds × 1,000, minutes × 60,000, hours × 3,600,000, days × 86,400,000). Its absolute value is then split from the largest unit down: whole days, then hours, minutes, seconds and the remaining milliseconds. Each format is built from those parts:
- Compact and Long list only the non-zero parts.
- ISO 8601 writes
P, the days, thenTand the hours, minutes and seconds. Milliseconds become decimal seconds, and zero isPT0S. - Clock shows total hours (days × 24 + hours), minutes and seconds, with
.mmmadded when there are milliseconds.
A minus sign is added to every format for negative input. It all runs in your browser.
Worked examples
93784000 milliseconds:
Compact: 1d 2h 3m 4s
Long: 1 day, 2 hours, 3 minutes and 4 seconds
ISO 8601: P1DT2H3M4S
Clock: 26:03:04
1500 milliseconds shows how fractions are handled:
Compact: 1s 500ms
ISO 8601: PT1.5S
Clock: 00:00:01.500
2.5 hours gives 2h 30m, PT2H30M and a total of 9,000 seconds, which is the number to put in a max-age or a TTL.
Limits and tips
- Days are 24 hours. Across a daylight-saving change a calendar day can be 23 or 25 hours, which this tool does not model.
- Table totals are rounded to 3 or 4 decimal places, so very short spans show 0 days or weeks.
- Very large values keep working, but the day count grows without limit; there is no year unit.
Frequently asked questions
Why does it stop at days instead of showing months or years?
Why is Clock 26:03:04 and not 1 day 02:03:04?
Can I paste a value like 1h30m to convert it back?
How are negative durations shown?
What about microseconds or nanoseconds?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.