ToolBoxOnline
Developer Tools

The Science of Cron Expressions How Scheduling Syntax Tells Computers Exactly When to Run Your Tasks

0 2 * * * looks like gibberish. To a computer, it means 'every day at 2am.' That's a cron expression — five fields that control automated tasks. Here's how the syntax works.

cron parsercron expressionschedulingautomationsyntax

You deploy a server. You want to run a database backup every day at 2am. You write a cron expression: 0 2 * * *. To a human, it is gibberish. To the computer, it is precise: run the task at minute 0, hour 2, every day of the month, every month, every day of the week. A cron parser translates this syntax into plain language. Here is how cron expressions work.

How Cron Expression Syntax Works

The five fields. A cron expression has five fields, separated by spaces: minute, hour, day of month, month, and day of week. 0 2 * * * means minute 0, hour 2, any day of month, any month, any day of week — every day at 2:00am. The cron parser breaks each field down and explains the schedule in plain language. Special characters. The asterisk * means "every." A slash */15 means "every 15" — */15 * * * * runs every 15 minutes. A comma 1,15 means "and" — 0 9,18 * * * runs at 9am and 6pm. A hyphen 1-5 means a range — 0 9 * * 1-5 runs at 9am on weekdays. Common mistakes. The day-of-week and day-of-month fields are both optional — leaving both as * runs daily. Setting both to specific values can produce confusing schedules. A cron parser catches these before they break your automation. Verify before deploying. Run the expression through the cron parser to confirm the schedule is what you intended. The unix timestamp converter handles time-based values. The cron parser is the translator. The five-field syntax is the language. The combination keeps your automated tasks running on schedule.

Tools mentioned in this article

Share this tool