Cron Generator

Build a cron expression by picking minutes, hours, days, months and weekdays on five tabs, so you never have to recall which field is day-of-month and which is day-of-week. A plain-English reading appears under the expression, and you can check it before the line goes into a crontab.

Generated Cron Expression
* * * * *
Every minute
Minute
Hour
Day
Month
Weekday

1 Example Expressions

Common Patterns

1
2
3
4
5
6
7
8
// At 04:05 on Sunday
5 4 * * 0

// Every 15 minutes
*/15 * * * *

// At 22:00 on every day-of-week from Monday through Friday
0 22 * * 1-5

2 Pick the schedule, then read it back

The two day fields

Restrict one day field, not both. When day-of-month and day-of-week are both set, standard cron runs the job when either matches. For example, 0 0 13 * 5 fires on every 13th and on every Friday.

A sentence you can review

Read the sentence before you copy. "At 17:00 on Friday" makes a wrong field obvious in a way that 0 17 * * 5 does not. The Last day of the month option writes L, which Quartz and some schedulers accept but standard crontab rejects.

How to use the Cron Expression Generator tool

  1. Open each of the five tabs (Minute, Hour, Day, Month, Weekday) and choose an option: every value, specific values, or on the Minute and Hour tabs an interval such as Every 15 minute(s).
  2. When you pick a Specific option, click the values in the grid; you can select several. The Day tab also offers Last day of the month, which writes L (accepted by Quartz, not by standard crontab).
  3. The expression at the top updates as you click, and the line under it explains the schedule in plain English, for example "At 09:00 on Monday through Friday".
  4. Click the copy icon next to the expression and paste it into your crontab, Kubernetes CronJob or GitHub Actions workflow.
  5. Click Reset to return to * * * * * (every minute).

How to schedule a cron job in crontab, Node.js and Python

crontab (Linux / macOS)

# Open your user's crontab in an editor
crontab -e

# ┌─ minute (0-59)
# │ ┌─ hour (0-23)
# │ │ ┌─ day of month (1-31)
# │ │ │ ┌─ month (1-12)
# │ │ │ │ ┌─ day of week (0-6, Sunday = 0)
# │ │ │ │ │
  */15 *  * * *   /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1
  0    9  * * 1-5 /usr/local/bin/report.sh
  30   2  1 * *   /usr/local/bin/monthly.sh

# List and remove
crontab -l
crontab -r

cron runs with a minimal PATH and no shell profile. Use absolute paths for commands and redirect output to a log, or you will never see the errors.

JavaScript (node-cron)

// npm i node-cron
const cron = require("node-cron");

// Every weekday at 09:00 in the given time zone
cron.schedule("0 9 * * 1-5", () => {
  console.log("Sending daily report", new Date().toISOString());
}, { timezone: "Europe/Amsterdam" });

// Validate an expression before saving it
console.log(cron.validate("*/15 * * * *")); // true
console.log(cron.validate("60 * * * *"));   // false

node-cron accepts an optional sixth field for seconds at the start. Standard crontab has no seconds field.

Python (croniter)

# pip install croniter
from datetime import datetime
from croniter import croniter

expr = "0 9 * * 1-5"
if not croniter.is_valid(expr):
    raise SystemExit("bad cron expression")

# Preview the next 3 run times from now
it = croniter(expr, datetime.now())
for _ in range(3):
    print(it.get_next(datetime))

# For a scheduler in-process see APScheduler's CronTrigger.from_crontab(expr)

Common errors and how to fix them

crontab: bad minute / errors in crontab file, can't install
A field is out of range, such as 60 in minutes or 24 in hours, or the line has fewer than five fields before the command. Check each field's range and use a single space or tab between fields.
The job runs at the wrong time by a few hours
cron uses the system time zone of the machine, usually UTC on servers and containers. Convert your local time to UTC, or set CRON_TZ=Europe/Amsterdam at the top of the crontab (cronie) or a timezone field in Kubernetes.
0 9 1 * 1 runs on the 1st AND every Monday
When both day of month and day of week are restricted, POSIX cron matches either one, not both. Restrict only one of the two, or check the date inside the script.
Percent signs in the command break it
In crontab, an unescaped % is turned into a newline and the rest is sent to the command's stdin. Escape it as \% (common in date +\%F).

Good to know

Standard cron has five fields, in order: minute, hour, day of month, month, day of week. Each takes a single value, a list (1,15), a range (1-5), a step (*/10) or *. Sunday is 0 or 7. Names like MON and JAN work in most implementations but not all, so use numbers where portability matters. There is no seconds field, so one minute is the finest schedule standard cron supports.

Restrict only one of the two day fields. When both day of month and day of week are restricted, the job runs when either matches, so 0 0 13 * 5 fires on the 13th of every month and also every Friday, not on Friday the 13th. Check the target system before you copy an expression: Quartz (Java) and some SaaS schedulers use a six or seven field syntax with ? and L, so a string that works in one place can fail or mean something else in another.

Specifications and references

This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.

Guides and tutorials

Frequently Asked Questions

What do the five fields of a cron expression mean?

From left to right: minute (0-59), hour (0-23), day of month (1-31), month (1-12) and day of week (0-6, Sunday is 0; most implementations also accept 7). An asterisk means every value.

How do I run a job every 15 minutes?

On the Minute tab, choose Every and type 15 into the minute(s) box. The expression is */15 * * * *.

Does this work with crontab, Kubernetes CronJob and GitHub Actions?

Yes. All three use the standard five-field syntax. Quartz adds a seconds field and AWS EventBridge adds a year field, so add those by hand when you target them. The Last day of the month option writes L, which standard crontab does not accept.

Which time zone does cron use?

The time zone of the machine or service running the job, which is usually UTC on servers. Convert your intended local time to that zone before you schedule. For example, 09:00 in New York during daylight saving time is 13:00 UTC.

Can I combine day of month and day of week?

Yes, but in standard cron the job runs when either field matches. For example, 0 0 13 * 5 fires on every 13th and on every Friday. Restrict one of the two fields and check the other inside your script.

Related

Cron runs in the server's time zone, which is usually UTC. When a log entry and a schedule disagree, the Unix timestamp converter shows the exact moment, and the date format converter handles the reverse lookup.

More Generators

Browse all generators

Copied to clipboard!