Cron expression guide
A cron expression is five fields that say when a scheduled job should run. Here is how to read and write them.
The five fields
┌─────────── minute (0-59)
│ ┌───────── hour (0-23)
│ │ ┌─────── day of month (1-31)
│ │ │ ┌───── month (1-12)
│ │ │ │ ┌─── day of week (0-6, Sun=0)
│ │ │ │ │
* * * * *Some schedulers add a leading seconds field, making a 6-field expression. CronKit understands both.
Special characters
| Character | Meaning | Example |
|---|---|---|
* | every value | * * * * * — every minute |
*/n | every n steps | */15 * * * * — every 15 minutes |
a-b | a range | 0 9 * * 1-5 — weekdays at 9 AM |
a,b | a list of values | 0 0 * * 6,0 — Saturday and Sunday |
L | last day of month | 0 0 L * * — last day at midnight |
Compute next runs in code
curl
curl "https://cron.wrapper-agency.com/api/v1/cron?expr=0 9 * * 1-5&tz=UTC"JavaScript (fetch)
const res = await fetch(
"https://cron.wrapper-agency.com/api/v1/cron?expr=" + encodeURIComponent("0 9 * * 1-5")
);
const { human, nextRuns } = await res.json();
console.log(human); // "At 09:00 AM, Monday through Friday"
console.log(nextRuns[0].iso); // next run as ISO timestampPython (requests)
import requests
r = requests.get(
"https://cron.wrapper-agency.com/api/v1/cron",
params={"expr": "0 9 * * 1-5", "tz": "Europe/Paris"},
)
print(r.json()["human"])Common expressions
- Run every minute —
* * * * * - Run every 5 minutes —
*/5 * * * * - Run every 10 minutes —
*/10 * * * * - Run every 15 minutes —
*/15 * * * * - Run every 30 minutes —
*/30 * * * * - Run every hour —
0 * * * * - Run every 2 hours —
0 */2 * * * - Run every 6 hours —
0 */6 * * * - Run every 12 hours —
0 */12 * * * - Run every day (at midnight) —
0 0 * * * - Run every weekday —
0 0 * * 1-5 - Run every weekend —
0 0 * * 6,0 - Run every week (Sunday) —
0 0 * * 0 - Run every month (1st) —
0 0 1 * * - Run every year —
0 0 1 1 *
See the full cron API reference, or start from the explainer & builder.