How to Build a Cron Expression (With Examples)
Cron is the Unix job scheduler that runs commands on a schedule. A cron expression is a five-field string that defines when a job runs — minute, hour, day of month, month, and day of week. The syntax is compact but cryptic until you've memorized the field order and special characters.
- Build cron expressions for scheduling jobs.
- The Five Fields.
- Covers common cron schedules.
- Covers special characters explained.
- Covers common gotchas.
The Five Fields
A cron expression has five fields separated by spaces:
minute (0–59) | hour (0–23) | day of month (1–31) | month (1–12) | day of week (0–6, Sunday=0)
Each field can be a specific value, a range (1-5), a list (1,3,5), a step (*/5 = every 5 units), or a wildcard (* = every value). Example: 30 9 * * 1-5 means 'at 9:30 AM, every weekday.'
Common Cron Schedules
Every minute: * * * * *
Every hour: 0 * * * *
Every day at midnight: 0 0 * * *
Every day at 9 AM: 0 9 * * *
Every Monday at 8 AM: 0 8 * * 1
Every weekday at 6 PM: 0 18 * * 1-5
First day of every month at noon: 0 12 1 * *
Every 15 minutes: */15 * * * *
Every 6 hours: 0 */6 * * *
Every Sunday at 2 AM: 0 2 * * 0
Special Characters Explained
* (wildcard) matches every value in the field. / (step) creates intervals — */5 in the minute field means every 5 minutes. - (range) specifies a continuous range — 1-5 in the day-of-week field means Monday through Friday. , (list) specifies discrete values — 1,15 in the day-of-month field means the 1st and 15th. Some implementations also support @ shortcuts: @hourly, @daily, @weekly, @monthly, @yearly.
background-size animation or @property registered custom properties instead.Common Gotchas
Cron uses 24-hour time — there's no AM/PM. The day-of-week field starts at 0 (Sunday) in most systems, but some use 7 for Sunday. If you specify both day-of-month and day-of-week, the job runs when either condition is true (OR logic), not when both are true — this surprises many people. Time zones matter — cron typically uses the server's local time zone. The Cron Builder tool lets you construct expressions visually, shows the next 5 run times, and catches these common mistakes.