Understanding Cron Expressions: A Complete Guide
A cron expression is a compact string of five space-separated fields that defines a recurring schedule. Originally created for the Unix cron daemon in the 1970s, cron expressions are now the universal language for scheduling tasks across operating systems, cloud platforms, CI/CD pipelines, container orchestrators, and web application frameworks. If you have ever set up an automated backup, a recurring email, or a periodic database cleanup, chances are a cron expression was involved.
The standard five-field format is minute hour day-of-month month day-of-week. Each field accepts specific values, ranges, lists, wildcards, and step intervals. Together they describe exactly when a job should run — from once a minute to once a year and everything in between.
The Five Fields Explained
The minute field (0–59) controls which minute of the hour the job fires. Setting it to 0 means the top of the hour; */15 means every 15 minutes. The hour field (0–23) uses 24-hour time: 0 is midnight and 13 is 1 PM. The day-of-month field (1–31) selects specific calendar dates. The month field (1–12 or JAN–DEC) restricts execution to certain months. The day-of-week field (0–7 or SUN–SAT, where both 0 and 7 represent Sunday) targets specific weekdays.
Special Characters and Syntax
The asterisk (*) means "every possible value" — * in the hour field matches hours 0 through 23. A comma creates a list: 1,3,5 in the day-of-week field matches Monday, Wednesday, and Friday. A hyphen defines a range: 9-17 in the hour field means 9 AM through 5 PM. A slash specifies step intervals: */10 in the minute field fires at 0, 10, 20, 30, 40, and 50 minutes past each hour. You can also combine a range with a step, such as 1-5/2 in the day-of-week field, which matches Monday, Wednesday, and Friday.
Common Cron Expressions
* * * * *— every minute0 * * * *— every hour on the hour0 0 * * *— once a day at midnight0 9 * * 1-5— weekdays at 9 AM0 0 1 * *— first day of every month at midnight*/5 * * * *— every 5 minutes0 0 * * 0— every Sunday at midnight0 0 1 1 *— once a year on January 1st at midnight
How Day-of-Month and Day-of-Week Interact
A subtlety that trips up many users: when both day-of-month and day-of-week are set to non-wildcard values, traditional cron implementations use a union (OR) — the job runs if either condition is met. For example, 0 0 15 * 5 runs at midnight on the 15th of every month and every Friday, not only on Fridays that fall on the 15th. When one of the two fields is *, the other field alone determines matching days.
Frequently Asked Questions
What is crontab?
crontab is the Unix command used to create, edit, and manage cron job schedules. Each user on a Unix system can have their own crontab file, and the cron daemon reads these files to execute jobs on schedule.
What is the difference between 5-field and 6-field cron?
The standard cron format has 5 fields (minute through day-of-week). Some systems like Spring and Quartz add a seconds field at the beginning, creating a 6-field format. This tool parses the standard 5-field format, which is the most widely used.
Can I use names instead of numbers?
Yes. The month field accepts three-letter abbreviations (JAN through DEC) and the day-of-week field accepts SUN through SAT. Names are case-insensitive and can be used in ranges, such as MON-FRI.
How do I test a cron expression?
Paste your expression into the input field above. This parser instantly shows a plain-English description, a breakdown of each field, and the next 10 scheduled execution times based on your current local time. Everything runs client-side in your browser — no data is sent to any server.
Bookmark this cron expression parser for quick reference whenever you need to write, debug, or verify a cron schedule. It's free, private, and works entirely in your browser.
Related reading: Cron Expressions Explained: How to Schedule Tasks