JSONHint

Preparing your workspace…

Cron Expressions Explained: Schedule Jobs Like a Pro

June 2026 · 5 min read · Tools, Basics, Web Dev

JH
JSONHint
By JSONHint · Practical guide

What is a Cron Job?

Cron is a time-based job scheduler in Unix-like operating systems. A cron job is a command or script that runs automatically at specified time intervals — without any human intervention. Cron is used to automate repetitive tasks such as:

  • Sending daily email reports or newsletters
  • Running database backups every night
  • Clearing temporary files or expired sessions weekly
  • Fetching data from APIs on a schedule
  • Generating and caching analytics reports
  • Rotating log files daily

Cron expressions are also used beyond Linux — in cloud schedulers (AWS EventBridge, GCP Cloud Scheduler), CI/CD pipelines (GitHub Actions scheduled workflows), task queues (Celery, Sidekiq), and application frameworks (Spring @Scheduled, Laravel Artisan).

The 5-Field Cron Format

A standard cron expression has 5 space-separated fields:

┌───────────── minute (0–59)
│ ┌───────────── hour (0–23)
│ │ ┌───────────── day of month (1–31)
│ │ │ ┌───────────── month (1–12)
│ │ │ │ ┌───────────── day of week (0–6, 0=Sunday)
│ │ │ │ │
* * * * *
FieldAllowed RangeSpecial Characters
Minute0–59* , - /
Hour0–23* , - /
Day of Month1–31* , - / ? L W
Month1–12 or JAN–DEC* , - /
Day of Week0–6 (0=Sun) or SUN–SAT* , - / ? L #

Special Characters Explained

*
Asterisk
Matches any value. "* * * * *" means every minute of every hour of every day.
,
Comma
Separates multiple values. "1,15,30 * * * *" runs at minutes 1, 15, and 30.
-
Hyphen
Defines a range. "9-17 * * * *" means every minute between 9:00 and 17:59.
/
Slash
Step values. "*/5 * * * *" means every 5 minutes. "0 */2 * * *" means every 2 hours.
?
Question Mark
Used in Day-of-Month or Day-of-Week to mean "no specific value" when the other is specified. Needed in Quartz/Spring schedulers.
L
Last
In Day-of-Month: "L" means the last day of the month. In Day-of-Week: "5L" means the last Friday.
#
Hash
Nth occurrence. "2#1" in Day-of-Week means the first Monday. Used in Quartz-based schedulers.

Common Cron Expression Examples

ExpressionMeaning
0 * * * *Every hour, on the hour (e.g., 1:00, 2:00, 3:00)
0 0 * * *Every day at midnight (00:00)
0 9 * * 1-5Every weekday (Mon–Fri) at 9:00 AM
*/15 * * * *Every 15 minutes
0 0 1 * *First day of every month at midnight
30 8 * * 1Every Monday at 8:30 AM
0 0 * * 0Every Sunday at midnight
0 2 * * *Every day at 2:00 AM (common for backups)
0 */6 * * *Every 6 hours (00:00, 06:00, 12:00, 18:00)
5 4 * * sunEvery Sunday at 4:05 AM

Build and Test Cron Expressions Online

Use the JSONHint Cron Expression Generator to visually build cron schedules using dropdowns and sliders — no need to memorize the syntax. The tool shows you a plain-English description of your schedule and lists the next 5 run times.

Related Tools