Back to Blog
6 min read

Understanding Cron Expressions: A Complete Guide

Cron is a time-based job scheduler in Unix-like computer operating systems. For decades, developers have used it to automate system maintenance or administration, but its syntax remains a common source of confusion.

The Structure of a Cron Expression

A standard cron expression consists of five fields separated by white space. Each field represents a specific unit of time:

FieldAllowed ValuesSpecial Characters
Minute0-59* , - /
Hour0-23* , - /
Day of Month1-31* , - / ? L W
Month1-12 or JAN-DEC* , - /
Day of Week0-6 or SUN-SAT* , - / ? L #

Special Characters Explained

*(Asterisk)

Specifies all values. For example, an asterisk in the minute field means "every minute".

,(Comma)

Separates items in a list. For example, 1,3,5 in the day of week field means "Monday, Wednesday, and Friday".

/(Slash)

Specifies increments. For example, */15 in the minute field means "every 15 minutes".

Common Cron Examples

  • 0 0 * * * - Run at midnight every day.
  • 0 12 * * MON-FRI - Run at noon every weekday.
  • */5 * * * * - Run every 5 minutes.
  • 0 0 1 * * - Run at midnight on the first day of every month.

Stop Guessing Your Cron Jobs

Writing cron expressions by hand is error-prone. Use our visual generator to build and validate your cron jobs instantly.

Open Cron Generator
YN

Yashraj Nigade

Web Developer