Cron Expression Parser

Analyze and explain cron expressions in plain language.

Minute
*
Hour
*
Day
*
Month
*
Weekday
*

Cron Expressions: Complete guide for scheduling tasks

A cron expression is a text string composed of 5 fields (minute, hour, day of month, month, day of week) that defines when a scheduled task runs. The cron format originated in Unix in the 1970s and remains the standard for scheduling automatic tasks on Linux servers, CI/CD pipelines, cloud services (AWS EventBridge, Google Cloud Scheduler), and tools like Kubernetes CronJobs.

Each field accepts specific values, ranges (1-5), lists (1,3,5), steps (*/5 = every 5), and the wildcard * (any value). Understanding cron syntax is essential for any developer working with automation, deployments, or scheduled tasks.

Cron expression format

minute hour day month weekday

  • * Any value (all)
  • , List of values (1,3,5)
  • - Range of values (1-5)
  • / Step or interval (*/5 = every 5)

Practical use cases

CI/CD Pipelines: Schedule nightly builds (0 2 * * * = every day at 2am), weekly deployments, or hourly integration tests to quickly detect regressions.

Automatic backups: Configure daily backups at 3am (0 3 * * *), weekly on Sundays (0 3 * * 0), or monthly on the first day (0 3 1 * *).

Data cleanup: Schedule deletion of old logs, expired sessions, or temporary files at regular intervals to keep the server optimized.

Frequently asked questions

What does */5 mean in a cron field?

*/5 means "every 5 units". In the minute field, */5 runs the task at minutes 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, and 55 of every hour.

Do days of the week start at 0 or 1?

It depends on the system. In most Unix implementations, 0 = Sunday and 6 = Saturday. Some systems also accept 7 as Sunday. To avoid confusion, use abbreviated names: MON, TUE, WED, THU, FRI, SAT, SUN.

Can I use cron in Node.js or Python applications?

Yes. Node.js has node-cron and cron packages. Python has APScheduler and the schedule library. These packages allow you to schedule tasks within your application without depending on the operating system's crontab.

What happens if the server is off when a task should run?

Cron does not execute missed tasks. If the server was off, the task simply doesn't run. For critical tasks, consider anacron (which runs pending tasks on boot) or services like systemd timers with Persistent=true.

Most common cron expressions

ExpressionDescription
* * * * *Every minute
*/5 * * * *Every 5 minutes
0 * * * *Every hour (at minute 0)
0 0 * * *Daily at midnight
0 9 * * 1-5Monday to Friday at 9am
0 0 1 * *First day of each month
0 0 1 1 *Once a year (January 1st)