Seconds Till Midnight
Calculate how many seconds remain until midnight from any given time
Pick any time of day and instantly see how many seconds are left until midnight — broken down into hours, minutes, and a day-remaining percentage. Useful for cron job timing, countdown widgets, or figuring out when an API rate limit resets at 00:00:00. And everything runs in your browser. Nothing gets uploaded.
How It Works
A day has 86,400 seconds (24 × 60 × 60). The tool converts your input time into total seconds since midnight, then subtracts that from 86,400. Simple arithmetic, but the kind you don't want to do in your head at 11 PM when a deploy window is closing.
Examples
Late-Night Deploy Check
Your CI pipeline needs to finish before the midnight maintenance window. It is 11:15 PM.
23:15:00
2,700 seconds
(45 minutes / 0.75 hours)
Countdown Timer for New Year
Building a countdown widget and you need the starting value in seconds. Current time: 6:00 PM.
18:00:00
21,600 seconds
(360 minutes / 6 hours)
API Rate Limit Reset
Your API quota resets at midnight. You're hitting a limit and want to know how long to set your retry delay. It is 3:42:30 PM.
15:42:30
29,850 seconds
(497.5 minutes / 8.29 hours)
Who Uses This
Setting countdown timers, scheduling cron jobs, or calculating API rate limit resets that happen at midnight.
Figuring out how long until a maintenance window opens or a log rotation kicks in.
Quick homework checks on time-to-seconds conversions without pulling out a calculator.
Calculating remaining seconds in a partition window when working with time-series data bucketed by day.
Common Mistakes
Entering "11:00" when you mean 11 PM gives you seconds from 11 AM. This tool uses 24-hour time, so 11 PM is 23:00.
Some people enter 24:00 expecting it to mean midnight. The standard 24-hour clock starts at 00:00:00. Entering midnight here returns 86,400 seconds — a full day.
This calculates pure arithmetic on a 24-hour day. On DST transition days, the actual clock time till midnight might be an hour off. For most uses that doesn't matter, but keep it in mind for precision work.
Technical Details
- Processing: 100% client-side JavaScript
- Browser Support: Chrome, Firefox, Safari, Edge
- Time Format: 24-hour (HH:MM:SS)
- Max Value: 86,400 seconds (full day at 00:00:00)
Frequently Asked Questions
How many seconds are there between now and midnight?
Click "Use Current Time" and then "Calculate." The tool grabs your device's clock and does the math for you. The result updates every time you click, so you'll always get a fresh count.
How do you calculate seconds until midnight manually?
Convert your time to total seconds since midnight: (hours × 3600) + (minutes × 60) + seconds. Then subtract that from 86,400. So for 10:30 PM (22:30:00), that's 81,000 seconds elapsed, leaving 5,400 seconds till midnight.
Why is midnight 86,400 seconds and not zero?
When you input 00:00:00 (midnight), you're at the very start of a day. The next midnight is a full 24 hours away — that is 86,400 seconds. Zero would mean you're already at midnight with no time left, which doesn't quite make sense in a "time remaining" context.
Can I use this for time zones other than mine?
Yes, just type in the current time for whatever time zone you care about. The tool doesn't check your system clock unless you press "Use Current Time." So if it is 3 PM in Tokyo and you want seconds till Tokyo's midnight, type 15:00:00 and hit Calculate.
Is there a formula for seconds remaining until midnight?
The formula is: 86400 - ((hours × 3600) + (minutes × 60) + seconds). That's it. Works for any time in 24-hour format. Most programming languages have built-in ways to get seconds since midnight, so you just subtract from the constant.