Skip to content
Allin

What Is a Cron Expression?

Published 7/28/2025 · 3 min read · Developer tools

Daniel Okonkwo

Daniel OkonkwoFront-end developer and tech writer at Allin

Web performance · File formats

Checked against 2 sources

View profile
In short

A cron expression is a short string that schedules a task to run automatically at set times, used by the Unix cron tool and many apps. It has five fields — minute, hour, day of month, month, day of week — so '0 9 * * 1' means 9:00 every Monday. An asterisk means 'every'. It's how servers run backups, reports and cleanups on a schedule.

A cron expression schedules a task to run automatically at set times. Here's what it's for, its five fields, how to read one, and the common gotchas.

What cron is for

Cron is the classic scheduler on Unix and Linux systems, and the same idea now appears in cloud services and app frameworks everywhere. Its job is to run a task automatically at recurring times without anyone pressing a button — nightly database backups, a report emailed every Monday, temporary files cleaned up each hour. Instead of remembering to do these chores, you describe when they should happen in a cron expression, and the scheduler takes care of the rest.

The five fields

A standard cron expression is five values separated by spaces, and their order is fixed: minute (0–59), hour (0–23), day of the month (1–31), month (1–12), and day of the week (0–6, where 0 is Sunday). Each field says when, within its range, the task should fire. Reading left to right, you're moving from the smallest unit of time to the largest and then to the weekday — once you know the order, any expression becomes readable.

Reading an expression

Beyond plain numbers, a few symbols do the heavy lifting. An asterisk means 'every' value of that field. A number means exactly that value. A slash sets a step, so */15 in the minute field means 'every 15 minutes'. A comma lists several values, and a dash gives a range. Put together, '0 9 * * 1' reads as: minute 0, hour 9, any day of the month, any month, on Monday — that is, 9:00 every Monday. Decode field by field and the whole thing falls into place.

Common patterns and gotchas

A few patterns cover most needs: '*/15 * * * *' runs every 15 minutes, '0 0 * * *' every day at midnight, '0 9 * * 1-5' at 9:00 on weekdays. Two things catch people out. When both the day-of-month and day-of-week fields are set, most cron implementations run the job if either matches, not both — a frequent surprise. And cron uses the server's clock, so double-check the timezone, or a 'midnight' job may fire at the wrong hour. When unsure, test the expression against a schedule preview before trusting it.

Cron expression generatorBuild a cron schedule field by field — minute, hour, day of month, month, weekday — and see the expression and a plain-language description update live. One-click presets cover the common schedules, and the syntax (*, */5, 1-5, 1,15) is explained inline.Try the tool

Frequently asked questions

What is a cron expression?
A string of fields that tells a scheduler when to run a task automatically.
What does '0 9 * * 1' mean?
Run at 9:00 every Monday.
What does the asterisk mean in cron?
'Every' — every minute, hour, day and so on, for that field.

Articles you may find interesting

All guides

Related tools

Sources

Spotted a mistake in this article?