What Is a Cron Expression?
A cron expression is a string of five fields (or six, when seconds are included) separated by spaces that defines when a scheduled task should run. The cron daemon on Linux and Unix systems checks these fields every minute and executes the associated command whenever the current time matches all of them.
Cron syntax is used far beyond the classic crontab: Kubernetes CronJobs, GitHub Actions schedule triggers, GitLab pipelines, AWS EventBridge, Google Cloud Scheduler, and frameworks such as Laravel, Spring, Celery and node-cron all rely on it. This free cron expression generator lets you build, read and verify those schedules without memorizing the syntax. Already have an expression? Paste it into the cron expression translator to see what it does.
Cron Syntax Explained: The 5 Fields
Every standard cron expression has five fields, read from left to right. Each field accepts a number, a list, a range, a step or an asterisk:
┌───────────── minute (0 - 59)
│ ┌─────────── hour (0 - 23)
│ │ ┌───────── day of month (1 - 31)
│ │ │ ┌─────── month (1 - 12 or JAN - DEC)
│ │ │ │ ┌───── day of week (0 - 6 or SUN - SAT, 7 = Sunday)
│ │ │ │ │
* * * * * /path/to/command
| Field | Allowed values | Special characters | Example |
|---|---|---|---|
| Minute | 0–59 | * , - / | */10 every 10 minutes |
| Hour | 0–23 | * , - / | 9-17 9 AM to 5 PM |
| Day of month | 1–31 | * , - / ? | 1,15 1st and 15th |
| Month | 1–12 or JAN–DEC | * , - / | */3 every quarter |
| Day of week | 0–6 or SUN–SAT (7 = Sunday) | * , - / ? | MON-FRI weekdays |
6-field cron with seconds: schedulers such as Spring @Scheduled, Quartz and node-cron prepend a seconds field (0–59), e.g. */10 * * * * * runs every 10 seconds. Classic Linux crontab does not support seconds — its smallest interval is one minute (see the every-30-seconds workaround).
Every operator, special string and edge case is covered in the cron syntax cheat sheet.
Cron Special Characters: * / , -
Asterisk (*) — every value
The asterisk matches all possible values of a field. * in the hour field means “every hour”; * * * * * runs every single minute.
Slash (/) — step values
The slash defines an interval. */15 in the minute field means every 15 minutes (0, 15, 30, 45). Combined with a range, 8-18/2 in the hour field means every 2 hours from 8 AM to 6 PM (8, 10, 12, 14, 16, 18).
Comma (,) — list of values
The comma separates individual values or ranges. 0 9,13,17 * * * runs at 9 AM, 1 PM and 5 PM. You can mix types: 1-5,15,30.
Hyphen (-) — ranges
The hyphen defines an inclusive range. 1-5 in the day-of-week field means Monday through Friday, and 9-17 in the hour field covers 9 AM to 5 PM.
Question mark (?) and macros
Some schedulers (Quartz, AWS) use ? in the day-of-month or day-of-week field to mean “no specific value”. Most cron implementations also accept shortcuts: @yearly (0 0 1 1 *), @monthly (0 0 1 * *), @weekly (0 0 * * 0), @daily (0 0 * * *), @hourly (0 * * * *) and @reboot (once at startup).
Day of month vs. day of week: the “OR” rule
When both the day-of-month and day-of-week fields are restricted, standard cron runs the job when either matches — not both. 0 9 1 * 1 runs on the 1st of every month and on every Monday. If one of the two fields is *, only the other one applies.
Cron Generators for Quartz, Spring, AWS, Hangfire, Airflow & More
Not every scheduler speaks Unix cron. Quartz and Salesforce add a seconds field and count Sunday as 1, Spring needs six fields, AWS EventBridge adds a year, and Jenkins has its own H symbol. Hangfire and node-cron take optional seconds and run only when both day fields match, while Airflow adds presets such as @once. Switch the format in the tool above, or open the generator for your platform:
0 0 8 ? * MON-FRI
Spring Cron Expression Generator
0 0 8 * * MON-FRI
AWS Cron Expression Generator
0 8 ? * MON-FRI *
Jenkins Cron Expression Generator
H 2 * * 1-5
Salesforce Cron Expression Generator
0 0 8 ? * MON-FRI
Hangfire Cron Expression Generator
0 8 * * 1-5
Airflow Cron Expression Generator
0 6 * * 1-5
node-cron Expression Generator
0 30 8 * * 1-5
Common Cron Expression Examples
Click any expression to load it into the tool above, or open its page for a full explanation. Browse all cron examples.
How to Set Up a Cron Job in Linux
Follow these steps to schedule a command with crontab on Ubuntu, Debian, CentOS, RHEL or any other Linux distribution:
- Open your crontab in the default editor:
crontab -e - Add a new line with the cron expression followed by the command. Always use absolute paths and log the output:
*/5 * * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1 - Save and exit the editor. You should see
crontab: installing new crontab. No restart is needed. - List your jobs to confirm it was saved:
crontab -l - Check the logs to verify the job runs:
grep CRON /var/log/syslog # Debian / Ubuntu journalctl -u cron --since "1 hour ago" journalctl -u crond # RHEL / CentOS / Fedora
Best practices for reliable cron jobs
- Use absolute paths for commands and files — cron runs with a minimal
PATH. - Escape percent signs as
\%; an unescaped%is treated as a newline. - Redirect output with
>> file.log 2>&1so errors are not lost. - Check the server time zone with
timedatectl— cloud servers often run in UTC. - Prevent overlapping runs of long jobs with
flock -n /tmp/job.lock command. - Use
sudo crontab -eor/etc/cron.d/for system-wide jobs that need root.
All crontab options, where the files live and how to fix a job that doesn't run are in the crontab guide.
Popular Cron Schedules
Ready-to-use expressions with explanations, copy-paste examples for crontab, Kubernetes and GitHub Actions, and common variations.
*/30 * * * * *
Every minute
* * * * *
Every 2 minutes
*/2 * * * *
Every 5 minutes
*/5 * * * *
Every 10 minutes
*/10 * * * *
Every 15 minutes
*/15 * * * *
Every 20 minutes
*/20 * * * *
Every 30 minutes
*/30 * * * *
Every 45 minutes
*/45 * * * *
Every 15 minutes in business hours
*/15 9-17 * * 1-5
Every hour
0 * * * *
Every 2 hours
0 */2 * * *
Every 3 hours
0 */3 * * *
Every 4 hours
0 */4 * * *
Every 6 hours
0 */6 * * *
Every 12 hours
0 */12 * * *
Every day at midnight
0 0 * * *
Every night at 2 AM
0 2 * * *
Every day at 9 AM
0 9 * * *
Every weekday (Monday to Friday)
0 9 * * 1-5
Every weekday at 8 AM
0 8 * * 1-5
Every Monday
0 9 * * 1
Every Friday
0 9 * * 5
Every Saturday
0 10 * * 6
Every Sunday
0 0 * * 0
Every weekend
0 10 * * 6,0
The first day of every month
0 0 1 * *
The 1st and 15th of every month
0 0 1,15 * *
The last day of every month
55 23 28-31 * *
Every quarter
0 0 1 */3 *
Every year
0 0 1 1 *
Frequently Asked Questions
What is a cron job?
A cron job is a command or script that the cron daemon runs automatically on a schedule on Unix-like systems such as Linux and macOS. Each job is defined by a cron expression of five time fields (minute, hour, day of month, month and day of week) followed by the command to execute. Cron jobs are commonly used for backups, log rotation, sending reports, clearing caches and syncing data.
How do special characters work in cron expressions?
The asterisk (*) matches every value of a field. The comma (,) separates a list of values, such as 1,15. The hyphen (-) defines an inclusive range, such as 1-5 for Monday to Friday. The slash (/) sets a step, so */15 in the minute field means every 15 minutes and 0-30/10 means minutes 0, 10, 20 and 30. You can combine them, for example 0,30 8-18/2 * * 1-5.
How do I set up a cron job in Linux?
Open your user's crontab with crontab -e, add a line containing the cron expression followed by the absolute path of the command (for example */5 * * * * /usr/local/bin/backup.sh), then save and exit. Verify it with crontab -l. Cron picks up the change automatically; check /var/log/syslog or journalctl -u cron to confirm that it runs.
What is the difference between 5-field and 6-field cron expressions?
Standard Unix crontab uses 5 fields: minute, hour, day of month, month and day of week. Some schedulers such as Spring, Quartz and node-cron add a seconds field at the start, giving 6 fields. This tool accepts both formats and treats the first field of a 6-part expression as seconds.
How do I run a cron job every 5 minutes?
Use */5 * * * *. The */5 in the minute field means every fifth minute (0, 5, 10 … 55), and the asterisks in the remaining fields mean every hour, every day, every month and every day of the week.
Which time zone does cron use?
Cron uses the system time zone of the server it runs on, which is often UTC on cloud servers. Check it with timedatectl or date. Some cron implementations support a CRON_TZ variable at the top of the crontab to set a different time zone. The next run times in this tool are shown in your browser's local time zone.
Why is my cron job not running?
The most common causes are relative paths or a missing PATH (cron runs with a minimal environment), a script that is not executable, a percent sign (%) that is not escaped with a backslash, a server time zone that differs from what you expected, and errors that are silently discarded. Redirect output to a log file with >> /tmp/job.log 2>&1 to see what happens.
What happens when both day of month and day of week are set?
In standard cron, if both the day-of-month and day-of-week fields are restricted (neither is *), the job runs when either one matches. For example, 0 9 1 * 1 runs at 9:00 AM on the 1st of every month and also every Monday.