Skip to content
100% local

ISO 8601 duration converter

Convert ISO 8601 durations like PT1H30M to seconds or readable text, and back.

Input
Output

ISO 8601 duration converter

Paste ISO 8601 durations such as PT1H30M, P3DT4H or P1Y2M and this tool converts each line to a number of seconds, minutes, hours or days, plus a readable breakdown like "1h 30min". Switch the direction and it works the other way too: paste a plain number of seconds (or whichever unit you pick) and get back a valid ISO 8601 duration string, ready to drop into an API payload, a calendar feed or a config file.

The Unit option decides what the number means, in both directions: when converting from ISO it's the unit the result is expressed in; when building ISO it's the unit your input numbers are read as. Show readable text toggles the human-friendly breakdown alongside the main result. Compact strips zero-valued units from the ISO output (PT1H30M instead of P0Y0M0DT1H30M0S) — turn it off for a fixed-width format with every field present. Decimal places controls rounding on the numeric value and the leftover-seconds component.

ISO 8601 years and months don't have a fixed length, so converting them to seconds is inherently approximate. Count years/months as lets you choose between a calendar average (365.2425 days per year) and a flat 365/30-day approximation — pick whichever your downstream system assumes, and treat any duration with a Y or M component as an estimate either way. Weeks, days, hours, minutes and seconds convert exactly. Turn on Show total of all lines to append a summed line, useful for adding up a batch of task durations.

Everything runs locally in your browser — durations and timestamps often come from internal logs or schedules, and none of it is uploaded anywhere. Copy the result, download it as a .txt file, or send the output back into the input to convert it again in the opposite direction.

FAQ

What ISO 8601 duration formats are supported?
The full P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S pattern — years, months, weeks, days, hours, minutes and seconds, with optional decimals and a leading minus sign for negative durations, in any combination that ISO 8601 allows (e.g. PT1H30M, P3DT4H, P1Y2M, P2W).
Why are conversions involving years or months approximate?
ISO 8601 doesn't fix how long a year or month is in seconds — it depends on the calendar. The Count years/months as option lets you pick a calendar average or a flat 365/30-day approximation; either way, treat results with a Y or M component as an estimate, not an exact value.
Can I convert a list of durations at once?
Yes. Each line is converted independently, and Show total of all lines adds a summed line at the end so you can total a batch of durations in one pass.
What happens with an invalid line?
The tool reports the line number and the exact text it couldn't parse, along with a couple of valid examples, so you can fix that line without losing the rest of your input.
Is my data uploaded anywhere?
No. Conversion runs entirely in your browser using plain JavaScript — your durations and numbers never leave your device.