Cron Expression Explainer & Generator
Explain what a cron expression does, or generate one from a common schedule. Everything runs in your browser.
Generate
Explain
The five fields
A standard cron expression is five space-separated fields, each specifying when a job may run:
┌─ minute (0-59) │ ┌─ hour (0-23) │ │ ┌─ day of month (1-31) │ │ │ ┌─ month (1-12) │ │ │ │ ┌─ day of week (0-6, 0 = Sunday) │ │ │ │ │ * * * * *
The job runs whenever the current time matches all five fields. Reading an expression left to right and translating each field is usually enough to understand it.
Field syntax
| Syntax | Meaning | Example |
|---|---|---|
* | Every value | * in hour means every hour |
5 | One specific value | 5 in minute means at minute 5 |
1-5 | A range | 1-5 in day-of-week means Monday to Friday |
1,15,30 | A list | At each listed value |
*/15 | A step | Every 15 units, so 0, 15, 30, 45 |
9-17/2 | Step within a range | 9, 11, 13, 15, 17 |
A frequent misreading: */15 in the minute field does
not mean "every 15 minutes starting from now". It means at
minutes 0, 15, 30, and 45 of every hour. Cron matches wall-clock values, it
does not track intervals since the last run.
Examples
| Expression | Meaning |
|---|---|
* * * * * | Every minute |
0 * * * * | Every hour, on the hour |
*/15 * * * * | At minutes 0, 15, 30, 45 |
0 9 * * 1-5 | 09:00, Monday through Friday |
30 2 * * * | 02:30 every day |
0 0 1 * * | Midnight on the first of each month |
0 0 * * 0 | Midnight every Sunday |
0 9-17 * * 1-5 | Hourly from 09:00 to 17:00 on weekdays |
0 0 1 1 * | Midnight on 1 January |
The day-of-month and day-of-week trap
This is the least intuitive rule in cron and a genuine source of production incidents.
Normally all fields must match, they are combined with AND. But when
both day-of-month and day-of-week are restricted (neither is
*), cron switches to OR.
So 0 0 1 * 1 does not mean "the first of the month, if it is a
Monday". It means the first of the month OR any Monday,
which fires far more often than intended.
To schedule reliably, leave one of the two as *. If you truly
need "the first Monday of the month", cron cannot express it directly, the
usual workaround is running daily and checking the date inside the script.
Time zones and daylight saving
Cron runs in the scheduler's local system time, and this tool does not account for time zones. That has consequences twice a year in regions observing daylight saving time:
- On the spring-forward day, a job scheduled at 02:30 may not run at all, because that local time does not occur.
- On the autumn-back day, it may run twice, because that local time occurs twice.
The reliable fix is running the server in UTC, which many teams adopt precisely for this reason. Alternatively, schedule sensitive jobs outside the 01:00 to 03:00 window where the transitions occur, and make jobs idempotent so a duplicate run is harmless.
Practical notes
Cron variants differ
This tool covers standard Unix and Linux cron with five fields. Other
schedulers extend the format: Quartz (Java) uses six or seven fields with
seconds and an optional year, and some systems support special strings such
as @daily or @reboot. Check your scheduler's
documentation before copying an expression between systems.
Overlapping runs
Cron starts a job on schedule regardless of whether the previous run has
finished. A job scheduled every five minutes that takes seven minutes will
accumulate overlapping processes. Use a lock file or a
flock wrapper if concurrent execution would cause problems.
Environment differences
Cron runs with a minimal environment, so PATH is often much
shorter than in an interactive shell. A script that works when run manually
and fails under cron usually needs absolute paths to its binaries. Redirect
output to a log file, otherwise error messages go to local mail and are
easily missed.
Frequently asked questions
Why five fields and not six or seven?
Five is the standard Unix and Linux format. Quartz and some other schedulers add seconds and year fields, which this tool does not cover.
What does day-of-week 0 mean?
Sunday. Values run 0 for Sunday through 6 for Saturday. Some implementations also accept 7 for Sunday.
Are month and weekday names supported?
Not by this tool, numeric values only. Many cron implementations accept
aliases such as JAN or MON, but numeric values work
everywhere.
Does */15 mean every 15 minutes from now?
No. It matches minutes 0, 15, 30, and 45 of each hour. Cron matches wall-clock values rather than tracking elapsed intervals.
How do I run something every 90 minutes?
You cannot express that in a single cron expression, because 90 minutes does not divide evenly into an hour. Either use two expressions covering the intended times, or run hourly and skip alternate executions in the script.
Which time zone does cron use?
The system's local time zone by default. Many teams run servers in UTC to
avoid daylight saving edge cases. Some cron implementations support a
CRON_TZ variable to set the zone per crontab.
Related tools
- Unix timestamp converter, for absolute points in time
- RegEx builder, for matching patterns in log output
- All developer tools