P
Privatool
Tutorial5 min read

Cron Expression Generator — Schedule Tasks with Cron Syntax Explained

Learn cron syntax with clear examples. Build cron job schedules visually and understand what any cron expression does. Free visual cron expression generator.

By Privatool Team·

A cron job is a scheduled task that runs automatically at specified time intervals on Unix-like operating systems. The name comes from Chronos (time in Greek). Cron automates repetitive operations: database backups, log rotation, email digests, cache invalidation, data synchronization, and report generation.

Cron expression syntax

A standard 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-7, where 0 and 7 = Sunday)
│ │ │ │ │
* * * * *

The five fields are evaluated together. A job runs when all five conditions match the current date and time.

Special characters

Character Meaning Example
* Any value * * * * * = every minute
, Value list 1,15,30 = at minutes 1, 15, and 30
- Range 1-5 = 1 through 5 (inclusive)
*/n Step values */15 = every 15 units
n/m Start/step 5/15 = at 5, 20, 35, 50

Common cron expressions

Expression Human-readable
* * * * * Every minute
*/5 * * * * Every 5 minutes
*/15 * * * * Every 15 minutes
0 * * * * Every hour at minute :00
0 9 * * * Every day at 9:00 AM
0 17 * * * Every day at 5:00 PM
0 9 * * 1-5 Weekdays at 9:00 AM
0 9 * * 1 Every Monday at 9:00 AM
0 0 1 * * First day of every month at midnight
0 0 * * 0 Every Sunday at midnight
0 0,12 * * * Twice daily: midnight and noon
30 6 * * 1,3,5 Mon/Wed/Fri at 6:30 AM
0 9-17 * * 1-5 Every hour from 9 AM to 5 PM on weekdays
0 0 1 1 * Once a year on January 1st at midnight

Practical examples by use case

Database backups

0 2 * * *

Every day at 2:00 AM — runs during low-traffic hours.

Weekly report generation

0 8 * * 1

Every Monday at 8:00 AM — report is ready when the work week starts.

Cache invalidation

*/10 * * * *

Every 10 minutes — keeps cached data reasonably fresh without constant updates.

Log rotation

0 0 * * 0

Every Sunday at midnight — weekly log rotation on the quietest night.

Health check ping

*/5 * * * *

Every 5 minutes — monitor uptime and alert if the service is down.

Extended cron syntax (6 fields)

Some systems add a seconds field at the start, making cron more precise:

┌────────────── second (0-59)
│ ┌──────────── minute (0-59)
│ │ ┌────────── hour (0-23)
│ │ │ ┌──────── day of month (1-31)
│ │ │ │ ┌────── month (1-12)
│ │ │ │ │ ┌──── day of week (0-7)
│ │ │ │ │ │
* * * * * *

This 6-field format is used by AWS EventBridge, Spring Boot @Scheduled, Quartz Scheduler, and node-cron.

Cron across different environments

Environment Format Min interval Notes
Linux crontab 5-field 1 minute Standard
GitHub Actions 5-field 5 minutes Minimum enforced
AWS EventBridge 6-field 1 minute Uses cron() wrapper
Heroku Scheduler UI-only 10 minutes No cron expression needed
node-cron 6-field 1 second Seconds field optional
Kubernetes CronJob 5-field 1 minute Standard Linux cron

Common mistakes

Day-of-month AND day-of-week: If both fields are set to specific values (not *), the job runs when either condition matches — not when both match. This is counterintuitive.

Minute vs hour confusion: 0 5 * * * runs at 5:00 AM (hour 5, minute 0). 5 0 * * * runs at 12:05 AM (hour 0, minute 5). The order is minute hour — minute comes first.

Timezone: System cron runs in the server's timezone. Cloud cron services (GitHub Actions, AWS EventBridge) typically run in UTC. Always check which timezone your scheduler uses.

How to generate cron expressions free

  1. Go to Cron Expression Generator
  2. Click a preset (Every 5 minutes, Weekdays 9 AM, etc.) to start quickly
  3. Or use the visual builder to set each field independently
  4. See the human-readable description update instantly
  5. Verify the next 5 scheduled run times
  6. Paste an existing expression to parse and edit it
#cron expression#cron job#cron syntax#task scheduling#linux cron

Try our free tools

All tools run in your browser. Files never leave your device.

Explore free tools →