DevBox

Cron Expression Generator

⑥ Scheduling & Ops

What it is: Scheduled jobs: have your server run a command automatically at a time you set (e.g. every midnight), no babysitting required.

When to use: When you need scheduled backups, cleanup, or scripts — a cron expression describes "when to run".

0-59

0-23

1-31

1-12

0-6 (0=Sun)

What this expression means

Next 5 run times (local timezone)

    Everything is computed locally in your browser — no data is uploaded.

    Once generated, where does it go?

    A cron expression only describes when; what actually runs is a command. Join the two on one line and drop it into your system's scheduler. The examples below update live with the expression above.

    1 Linux / macOS: crontab (most common)

    Use this to run scripts on a schedule on a server. Enter the command you want to run to get the full "expression + command" line:

    1. 1. In a terminal, run crontab -e to open the current user's cron jobs
    2. 2. Paste the whole line above
    3. 3. Save and exit (in vim, press Esc, type :wq and hit Enter)
    4. 4. Run crontab -l to list the jobs you've added
    💡 Tip: cron runs with a very minimal PATH, so prefer absolute paths for commands (e.g. /usr/bin/python3); it also helps to write output to a log for debugging by appending >> /var/log/mytask.log 2>&1 to the command.

    2 System-wide: /etc/cron.d (one extra "user" field)

    When writing into /etc/crontab or a file under /etc/cron.d/, you need one extra field — "which user to run as" — compared to a user crontab (requires root):

    3 Windows: no cron — use Task Scheduler

    Windows doesn't support cron syntax; here are three equivalent approaches:

    • GUI: search the Start menu for "Task Scheduler", create a task, and set its trigger time.
    • Command-line schtasks, e.g. "run every day at 03:00":
    schtasks /create /tn "MyTask" /tr "C:\path\script.bat" /sc daily /st 03:00

    • Or install WSL (Linux on Windows) and use the crontab above directly.

    Note: schtasks uses its own flags (/sc daily, /sc hourly…) and does not accept cron expressions; for complex schedules, prefer WSL + crontab.

    4 In code or CI (reuse this expression directly)

    Many frameworks accept cron expressions directly — just paste the expression generated above:

    Node.js(node-cron)

    cron.schedule('', () => { /* your task */ })

    Python(APScheduler)

    CronTrigger.from_crontab('')

    Spring (6 fields — seconds come first; a leading 0 is added automatically)

    @Scheduled(cron = "")

    GitHub Actions

    on:
      schedule:
        - cron: ''

    Kubernetes CronJob

    schedule: ""

    Common cron expression examples

    Click any row to load it into the tool above and see its explanation and run times.

    Expression Meaning
    */5 * * * * Every 5 minutes
    0 * * * * Every hour, on the hour
    0 0 * * * Every day at midnight
    0 3 * * * Every day at 3 AM (common for backups)
    0 9 * * 1 Every Monday at 9 AM
    0 0 1 * * On the 1st of every month at midnight
    0 18 * * 1-5 Weekdays (Mon–Fri) at 6 PM
    30 2 * * 0 Every Sunday at 2:30 AM

    FAQ

    What are the five fields in a cron expression?

    From left to right: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-6, where 0 is Sunday). Fields are separated by spaces.

    What's the difference between * and */5 in crontab?

    * means "every" (e.g. * in the minute field means every minute); */5 means "every 5 units" (e.g. */5 in the minute field means every 5 minutes).

    Do both 0 and 7 mean Sunday in the day-of-week field?

    In most implementations 0 means Sunday; some also accept 7 for Sunday. For compatibility, stick with 0.

    How do I confirm the cron expression AI gave me is correct?

    Paste it into the input above and the page instantly shows an explanation and the next 5 run times — you can verify at a glance that it matches your intent, without worrying about AI hallucinations.

    Learn more about cron

    Related tools