Understanding Cron Expressions: A Complete Guide

Cron expressions schedule automated tasks in servers, CI/CD pipelines and cloud functions. Learn to read and write them confidently with this practical guide.

Cron is a time-based job scheduler in Unix-like systems. Cron expressions define when a task should run — from "every minute" to "at 9am on weekdays in January". They are used everywhere: server maintenance scripts, database backups, email digests, CI/CD pipeline triggers and serverless cloud functions like AWS Lambda or Google Cloud Scheduler.

The Five Fields

A standard cron expression has five fields separated by spaces: minute (0–59), hour (0–23), day of month (1–31), month (1–12) and day of week (0–6, where 0 is Sunday). An asterisk (*) in any field means "every valid value". The simplest expression, "* * * * *", runs a task every single minute.

Special Characters

The slash (/) sets step values — "*/5" in the minute field means every 5 minutes. A hyphen (-) defines a range — "1-5" in the day-of-week field means Monday through Friday. A comma (,) separates multiple values — "0,6" means Sunday and Saturday. These can be combined freely: "0 8 */2 * *" runs at 8am every two days.

The Most Common Cron Schedules

"0 * * * *" runs at the start of every hour. "0 0 * * *" runs at midnight every day. "0 9 * * 1-5" runs at 9am on Monday through Friday. "0 0 1 * *" runs at midnight on the first day of every month. "*/15 * * * *" runs every 15 minutes. "0 0 1 1 *" runs at midnight on January 1st each year.

Common Mistakes

The most frequent error is confusing day-of-week numbering — 0 is Sunday in most systems, but some use 7 for Sunday too. Another common mistake is using "0 0 30 2 *" (Feb 30 does not exist) or writing "* * * * 1-7" and expecting it to exclude Sundays. Always test your expressions with a visualizer before deploying.

How to Use the Cron Explainer Tool

Type any cron expression into the input field and the tool instantly translates it into plain English. Each field is color-coded and explained separately — you can see at a glance what each part controls. Use the preset buttons to start from a common schedule and modify it to your needs.

→ Cron Explainer