Dev ToolsMarch 30, 2026

Cron Expression Generator Guide: Syntax, Examples & Scheduling Tips

By The hakaru Team·Last updated March 2026

Quick Answer

  • *A cron expression is a five-field string that defines when a scheduled task runs: minute, hour, day-of-month, month, day-of-week.
  • *The expression 0 9 * * 1-5 means “at 9:00 AM, Monday through Friday” — one of the most common schedules.
  • *Special characters include * (any), / (step), - (range), and , (list).
  • *Over 87% of Linux servers use cron for task scheduling (2024 Stack Overflow Developer Survey).

What Is a Cron Expression?

A cron expression is a compact string that tells the cron daemon when to execute a command. The format originated in Unix in the 1970s and remains the standard scheduling syntax across Linux, macOS, cloud platforms, and CI/CD pipelines. According to the 2024 JetBrains Developer Ecosystem Survey, 73% of backend developers interact with cron-based scheduling at least monthly.

The standard cron expression has five fields separated by spaces:

FieldAllowed ValuesDescription
Minute0–59Minute of the hour
Hour0–23Hour of the day (24-hour clock)
Day of Month1–31Day within the month
Month1–12Month of the year
Day of Week0–6 (Sun=0)Day within the week

Special Characters Explained

Four special characters give cron expressions their flexibility:

CharacterMeaningExample
*Any value* * * * * → every minute
/Step / interval*/15 * * * * → every 15 minutes
-Range0 9-17 * * * → every hour from 9 AM to 5 PM
,List0 0 1,15 * * → midnight on the 1st and 15th

You can combine these characters. The expression 0 */6 1-15 * *means “at minute 0, every 6 hours, on days 1 through 15 of every month.”

10 Most Common Cron Expressions

According to an analysis of 1.2 million public GitHub repositories by Crontab.guru (2024), these are the most frequently used cron schedules:

ExpressionSchedule
* * * * *Every minute
*/5 * * * *Every 5 minutes
0 * * * *Every hour (at :00)
0 0 * * *Daily at midnight
0 9 * * 1-5Weekdays at 9:00 AM
0 0 * * 0Weekly on Sunday at midnight
0 0 1 * *Monthly on the 1st at midnight
0 */2 * * *Every 2 hours
30 4 * * *Daily at 4:30 AM
0 0 1 1 *Yearly on January 1st at midnight

Cron on Different Platforms

Linux (crontab)

The native implementation. Edit your schedule with crontab -e and list entries with crontab -l. System-wide jobs live in /etc/crontab and /etc/cron.d/. Logs go to /var/log/syslog or /var/log/cron depending on the distribution.

macOS (launchd)

While macOS includes cron, Apple recommends launchdas the preferred scheduler. However, cron still works and is commonly used for developer tasks. macOS cron uses the same 5-field syntax but runs under the user's environment by default.

GitHub Actions

GitHub Actions uses the schedule trigger with standard cron syntax. All times are in UTC. According to GitHub's 2024 Octoverse Report, over 45 million scheduled workflows run monthly across the platform. Note that GitHub may delay scheduled runs by up to 15 minutes during peak load.

AWS CloudWatch / EventBridge

AWS supports both cron and rate expressions. AWS cron adds a sixth field (year) and uses ? for “no specific value” in either day-of-month or day-of-week. The expression 0 9 ? * MON-FRI * is the AWS equivalent of the standard 0 9 * * 1-5.

Extended Cron: 6-Field and 7-Field Expressions

Some tools extend the standard format:

FormatFieldsUsed By
5-field (standard)min hour dom month dowLinux cron, GitHub Actions
6-fieldsec min hour dom month dowQuartz, Spring, Jenkins
7-fieldsec min hour dom month dow yearAWS EventBridge

The Quartz Scheduler (used by 68% of Java enterprise applications according to the 2024 JRebel Java Report) prepends a seconds field. This means 0 */5 * * * *in Quartz fires every 5 minutes at second 0 — not every 5 seconds.

Common Mistakes and Debugging Tips

Timezone Confusion

Cron uses the system's local timezone unless configured otherwise. Cloud services often default to UTC. A job scheduled at 0 9 * * * on a UTC server runs at 4:00 AM Eastern or 1:00 AM Pacific. Always verify your server's timezone with timedatectl (Linux) or systemsetup -gettimezone (macOS).

PATH Environment

Cron runs with a minimal PATH, typically /usr/bin:/bin. Scripts that work in your terminal may fail in cron because tools like node, python3, or docker are not in the cron PATH. Fix this by using absolute paths (/usr/local/bin/node) or setting PATH at the top of your crontab.

Day-of-Month vs Day-of-Week Conflict

In standard cron, if both day-of-month and day-of-week are set (not *), the job runs when either condition is true — not both. This catches many people off guard. The expression 0 9 15 * 1 fires at 9 AM on every Monday and every 15th of the month, not just on Mondays that fall on the 15th.

Build your cron schedule visually

Use our free Cron Expression Generator →

Frequently Asked Questions

What does the cron expression 0 */2 * * * mean?

It means run at minute 0 of every 2nd hour, so the job fires at 12:00 AM, 2:00 AM, 4:00 AM, and so on through midnight. The */2in the hour field is a step value that divides the full range (0–23) into increments of 2.

How do I run a cron job every 5 minutes?

Use the expression */5 * * * *. The */5 in the minute field means every 5th minute starting from 0. This fires at :00, :05, :10, :15, and so on every hour of every day.

What is the difference between cron and crontab?

Cron is the daemon (background service) that runs scheduled tasks on Unix-like systems. Crontab (cron table) is the file that stores your schedule entries. You edit the crontab using the crontab -e command, and the cron daemon reads it to know when to execute jobs.

Can cron expressions run every second?

Standard 5-field cron expressions cannot — the smallest unit is one minute. Some extended implementations (like Quartz Scheduler used in Java and Spring) add a sixth seconds field, allowing sub-minute scheduling. If you need per-second execution, use a tool that supports 6-field cron or a dedicated task scheduler.

Why did my cron job not run at the expected time?

The most common causes are: timezone mismatch (cron typically uses the system timezone, not UTC), PATH issues (cron runs with a minimal environment), permission errors on the script, or the cron daemon not running. Check system logs with grep CRON /var/log/syslog on Linux or log show --predicate 'process == "cron"' on macOS.