Home Tools Blog About

Convert Time to Seconds

In short

Convert HH:MM:SS, ISO 8601, compact, words to total seconds (and back). Batch input. Free, offline, client-side, instant, secure.

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

Convert any time expression to total seconds - supports HH:MM:SS, ISO 8601 duration (P1DT2H3M4S), compact (1d 2h 3m), words (1 hour 30 minutes), and decimal-with-unit (8.5h). Batch input emits TSV with seconds + HH:MM:SS + compact + ISO columns. Reverse direction available.

Type to begin.
🛡
100% PrivateNo server uploads, ever
InstantRuns in your browser
💧
No WatermarksClean output, always
🆓
Free ForeverNo accounts, no limits

How to Use Convert Time to Seconds

  1. Type or paste a time expression. Seven formats supported: HH:MM:SS (2:15:30), HH:MM (1:30), bare hours (8), ISO 8601 duration (P1DT2H3M4S), compact (1d 2h 3m 4s), word form (1 hour 30 minutes), and decimal-with-unit (8.5h, 1500ms). Mix formats freely in batch mode.
  2. Watch the TSV output panel. Each input gets one row in a 5-column TSV: Input / Seconds / HH:MM:SS / Compact / ISO 8601. So 1h 30m becomes 1h 30m → 5400 → 01:30:00 → 1h 30m → PT1H30M. Download as .tsv and Excel/Sheets parses it into 5 columns automatically.
  3. Negatives are rejected, not silently converted. Type -3600 and you get an error pointing at the issue, not the wrong "3600 seconds" most converters would return after silently calling Math.abs(). Use Swap if you actually want to handle negative durations.
  4. Sub-second precision preserved. Decimal inputs like 3661.5 seconds round-trip through compact (1h 1m 1.5s) and ISO (PT1H1M1.5S) without losing the fractional part. Useful for sub-second time math from logs or scientific data.
  5. Batch with stats. Multi-line or comma-separated input gets row-by-row conversion plus aggregate stats: count, ok/error counts, sum (total seconds), mean, min, max. Useful for adding up a column of times - paste in raw HH:MM:SS values and see the total seconds plus average.
  6. Swap for reverse. ⇄ flips to Seconds → Time. Input is just numbers (e.g., 5400), output is the same 4 formats: HH:MM:SS, compact, ISO. Useful when your data comes from a log timestamp or a Unix epoch arithmetic and you want the human-readable duration.
  7. Stats line summarizes. Direction, count, ok/error counts, sum (for forward), mean and min/max when there's more than one valid value. Tells you instantly whether your batch parsed correctly without scanning every row.

Frequently Asked Questions

Which input formats are supported?

Seven: (1) Colon-separated HH:MM:SS, HH:MM, or D:HH:MM:SS. (2) Bare number = hours. (3) ISO 8601 duration PnDTnHnMnS (case-insensitive). (4) Compact with unit suffixes: 1d 2h 3m 4s. (5) Word form: "1 hour, 30 minutes" with commas optional. (6) Decimal-with-unit: 8.5h, 1500ms. (7) Plain decimal seconds (no unit) – passes through unchanged. Mix formats in batch mode; each line parsed independently.

What happens with negative values?

Rejected with the specific error “Negative duration not allowed – use absolute value or Swap to reverse”. This is intentional. Many time-to-seconds tools silently call Math.abs() so -3600 becomes 3600 with no warning. That hides bugs. This tool surfaces the issue instead – if your data has unexpected negatives, you’ll see it immediately.

Can I really use decimal hours like 8.5h?

Yes. 8.5h → 30,600 seconds. 1.25h → 4500 seconds. 0.5d → 43,200 seconds. The parser recognizes decimals before any unit suffix (d/h/m/s/ms). Useful for payroll-style time tracking where times are stored as decimal hours.

What’s ISO 8601 duration format?

The standard interchange format for durations: P[nD][T[nH][nM][nS]]. So P1DT2H3M4S = 1 day, 2 hours, 3 minutes, 4 seconds = 93,784 seconds. APIs (OpenAPI, JSON Schema, GraphQL) and databases (PostgreSQL interval) use this format. The parser is case-insensitive and accepts decimal values in any field (PT1.5H = 5400 seconds).

Does it preserve millisecond precision?

Yes. Decimal seconds in any input format propagate through. 3661.5 → 3661.5 seconds → reverse-encodes as 01:01:01.500 in HH:MM:SS, 1h 1m 1.5s in compact, PT1H1M1.5S in ISO. The output stays consistent with the input precision.

How does batch mode work?

Multiple lines or comma/semicolon-separated entries become one row each in the output TSV. Each line is parsed independently – one bad line gets an ERROR row but doesn’t fail the rest. Stats show ok vs error counts, sum (total seconds across all valid rows), mean, min, max. Useful for time-tracking spreadsheets where you have a column of durations and want a total in seconds.

Can the parser handle word form like “1 hour 30 minutes”?

Yes. 1 hour 30 minutes, 1h 30m, 1 hr 30 min all give 5400. The parser uses a regex matching digits followed by a unit word (with or without space). Commas and “and” are tolerated as separators: 1 hour, and 30 minutes works too. Unit-less numbers in word form context are skipped (not treated as seconds).

What’s the difference vs the “Convert Seconds to Time” tool?

That sibling tool starts with seconds and produces multiple time formats. This one starts with time formats and produces seconds (plus a few extra formats). Same parser/serializer under the hood – just the default direction differs. Swap on either tool flips them to be functionally equivalent. Two URLs because “time to seconds” and “seconds to time” are both common search queries.

Is my time data uploaded anywhere?

No. All parsing, math, and TSV emission run in your browser. Open DevTools → Network and confirm zero requests fire – even when you Convert or Download. Safe for time-tracking spreadsheets, video metadata, or log timestamps you’d rather not send to a third-party converter.

Does it work offline?

Yes. Total bundle is about 18 KB. Load once, disconnect, keep using. Pure JavaScript arithmetic – no fonts to fetch, no analytics, no remote API. Useful for time math on planes, in airgapped dev environments, or anywhere a cloud-based converter wouldn’t reach.

Keep going

Related Tools

All Time tools →

Convert Seconds to Time

Convert seconds to HH:MM:SS, days/hours/minutes/seconds, words, and ISO 8601 duration. Reverse too. Free, offline,…

Add Fuzziness to Clock Time Generator

Add Fuzziness to Clock Time Online - Generate randomized time variations for testing, simulations,…

Analyze Clock Time

Mathematically Analyze Clock Time perfectly. Uncover fuzzy phrasing, precise AM/PM calculations, completed percentages, and…

Calculate Average Clock Time

Calculate the average clock time from a list using circular mean - correct across…

Calculate Seconds Since Midnight

Calculate Seconds Since Midnight - exact seconds elapsed since midnight for current or custom…

Calculate Seconds Till Midnight

Calculate Seconds Till Midnight and Count the seconds left until midnight for current or…

Calculate Time Zone Difference

Calculate Time Zone Difference between any two time zones with DST awareness. Free, offline,…

Convert Human Time to Unix Time

Convert dates to Unix timestamps - seconds, ms, μs, ns, FILETIME, ISO. Timezone-aware. Free,…

Convert Military Time to Regular Time

Convert 24-hour military time to 12-hour AM/PM (and reverse). Zulu, batch mode, all zone…

Convert Regular Time to Military Time

Convert 12-hour AM/PM time to 24-hour military time and back. Handles seconds, noon/midnight, and…

Convert Time Between Countries

Convert time between 53 countries with IANA DST handling, date picker, up to 3…

Convert Time Between Timezones

Convert time between any IANA timezones with DST handling, date picker, up to 3…

Share

Embed this tool

Add this free tool to your website. Copy and paste the code: