How Cron Expressions Work: Syntax Explained
Last updated: December 5, 2026
Cron Expression Generator
Build and validate cron expressions visually without memorizing syntax.
Try It Free →A cron expression is a compact string that tells a scheduler exactly when to run a job. It looks cryptic at first glance, but once you understand what each field represents, you can read and write schedules as naturally as reading a clock. This guide covers the full syntax, every special character, and the mistakes that cause silent failures.
Last updated: July 2026
The Five-Field Standard Format
A standard cron expression has five space-separated fields:
* * * * *
│ │ │ │ │
│ │ │ │ └─ Day of week (0-7, where 0 and 7 both mean Sunday)
│ │ │ └─── Month (1-12)
│ │ └───── Day of month (1-31)
│ └─────── Hour (0-23)
└───────── Minute (0-59)
Some systems, including many cloud job schedulers and AWS EventBridge, add a sixth field for seconds at the front or a seventh for years at the end. Always check your platform's documentation before assuming the standard five-field layout.
What Each Field Accepts
Exact Values
Write a plain integer to match that exact unit of time. 30 14 * * * means "at 14:30 every day." The minute field is 30, the hour field is 14, and the remaining three fields are wildcards.
The Asterisk Wildcard
An asterisk means "every valid value for this field." * * * * * fires every minute of every hour of every day. Use it only where you genuinely mean "all values," not as a placeholder you plan to fill in later.
Commas for Lists
Separate multiple values with a comma. 0 9,17 * * * fires at 09:00 and 17:00 every day. There is no limit on how many values you can list, but a very long list usually signals that a range or step would be cleaner.
Hyphens for Ranges
A hyphen defines an inclusive range. 0 9 * * 1-5 fires at 09:00 on Monday through Friday. The day-of-week field uses 0 or 7 for Sunday and 1 through 6 for the remaining days.
Slashes for Steps
A slash means "every N units." */15 * * * * fires every 15 minutes. 0 */6 * * * fires every six hours at the top of the hour. You can combine a range with a step: 0-30/10 * * * * fires at minute 0, 10, 20, and 30.
Special Strings Your Platform May Support
Many cron daemons and schedulers accept shorthand aliases:
- @yearly or @annually: runs once a year at midnight on January 1 (equivalent to
0 0 1 1 *) - @monthly: runs at midnight on the first of every month (
0 0 1 * *) - @weekly: runs at midnight every Sunday (
0 0 * * 0) - @daily or @midnight: runs once a day at midnight (
0 0 * * *) - @hourly: runs at the top of every hour (
0 * * * *) - @reboot: runs once at system startup (not applicable in cloud schedulers)
These aliases improve readability, but they are not universal. Test them in your specific environment before relying on them in production.
The Day-of-Month and Day-of-Week Conflict
This is the most common source of unexpected behavior in cron. When you specify a value in both the day-of-month field and the day-of-week field (not wildcards), most traditional cron implementations fire if either condition is true, not both. So 0 12 15 * 5 fires at noon on the 15th of every month AND at noon every Friday, not only on Fridays that fall on the 15th.
If you need a job to run only when both conditions are true, you cannot express that in standard cron alone. You have to handle the extra check inside the job script itself, or use a more capable scheduler that supports AND logic.
Time Zones and Cron
Standard cron runs in the system time zone of the host machine. If your server is set to UTC and you want a job at 09:00 New York time, you must subtract the offset yourself. During Eastern Standard Time that is 14:00 UTC; during Eastern Daylight Time it is 13:00 UTC, which means a schedule that is correct in winter is wrong in summer unless you account for daylight saving.
Cloud platforms such as Google Cloud Scheduler and GitHub Actions let you specify a time zone alongside the cron string. Use that feature whenever it is available. It is far safer than calculating offsets manually. When you need to verify exact timestamps, a tool like the Unix timestamp converter helps you confirm that a scheduled time translates to the UTC moment you expect.
Common Mistakes and How to Fix Them
Off-by-one on day of week
Some systems treat Sunday as 0, others as 7, and a few accept both. Always test a new scheduler with a short interval first to confirm which convention it uses before deploying a weekly job.
Using 60 as a minute value
Minutes run from 0 to 59. Writing 60 either causes a parse error or silently wraps around. If you want "top of the hour," use 0.
Forgetting that cron has no concept of "last day of month"
Standard cron cannot express "run on the last day of every month" because months have different lengths. Some extended implementations support the L character for this purpose. If yours does not, run the job daily and check inside the script whether today is the last day.
Overlapping executions
Cron fires a new process at each scheduled time regardless of whether the previous one is still running. A job that takes longer than its interval will accumulate concurrent processes, eventually exhausting memory or file handles. Use a lock file or a job queue to prevent overlap for long-running tasks.
Building and Validating Expressions
Writing cron expressions by hand is error-prone, especially for complex schedules. Use a visual builder to construct the expression interactively, then read the human-readable description back to yourself before deploying. The cron expression generator on EveryFreeTool lets you do exactly that without installing anything.
Once you have an expression, verify it by listing the next several fire times and checking that they match your intent. Many schedulers have a "dry run" or "preview" mode for this. If yours does not, a cron parser library in Python or Node.js can generate the next N occurrences in a few lines of code.
For jobs that are time-sensitive down to the second, remember that standard cron has one-minute resolution. If you need sub-minute scheduling, look at systemd timers, AWS EventBridge Scheduler with rate expressions, or application-level schedulers such as APScheduler or Sidekiq.
Cron in Modern Contexts
Beyond the classic Unix crontab, cron syntax appears in Kubernetes CronJobs, CI/CD pipelines like GitHub Actions and GitLab CI, serverless platforms, and database job schedulers. The core syntax is consistent, but each platform adds its own extensions and restrictions. GitHub Actions, for example, uses UTC exclusively and does not run jobs more frequently than every five minutes on shared runners.
When you work across multiple platforms, it pays to keep a reference of which fields each one supports. For anything involving date arithmetic around your scheduled jobs, the epoch converter is a quick way to sanity-check that a timestamp lands where you think it does.
If your project also involves parsing or transforming structured data as part of a scheduled pipeline, tools like the JSON formatter can speed up debugging the payloads your jobs produce or consume.
Quick Reference
- Every minute:
* * * * * - Every hour at minute 0:
0 * * * * - Every day at 03:00 UTC:
0 3 * * * - Every Monday at 08:30:
30 8 * * 1 - Every 5 minutes:
*/5 * * * * - First of every month at midnight:
0 0 1 * * - Weekdays at 09:00 and 17:00:
0 9,17 * * 1-5 - Every 15 minutes between 08:00 and 18:00 on weekdays:
*/15 8-18 * * 1-5
Cron expressions reward a small investment of learning time with a tool you will use throughout your career. Once the five fields are second nature, you can read a schedule at a glance and spot errors before they cause a silent 03:00 failure. When you need to build or verify an expression quickly, the cron generator is there to do the heavy lifting.
Unix Timestamp Converter
Convert between human-readable dates and Unix timestamps for scheduling work.
Try It Free →Frequently Asked Questions
What is the difference between a cron expression and a cron job?
A cron job is the complete scheduled task, including the command or script to run and the schedule that controls when it runs. A cron expression is just the schedule portion, the string of fields that tells the scheduler the timing. You can think of the cron expression as the trigger and the cron job as the full definition that includes both the trigger and the action.
Why does my cron job run twice when I specify both a day-of-month and a day-of-week?
Traditional cron implementations treat the day-of-month and day-of-week fields as an OR condition when both are set to non-wildcard values. That means the job fires if either the day-of-month matches OR the day-of-week matches, not only when both match at the same time. If you need AND logic, you must handle the extra condition inside the job script itself or switch to a scheduler that supports combined conditions.
How do I schedule a cron job in a specific time zone?
Standard Unix cron uses the system time zone of the host machine, so you have to convert your desired local time to that zone manually. Cloud platforms such as Google Cloud Scheduler, AWS EventBridge Scheduler, and GitHub Actions allow you to specify a time zone string alongside the cron expression, which is the safer approach. If you use a system cron, set the TZ environment variable in the crontab or on the specific job line to override the system default.
Can cron run a job more frequently than once a minute?
No, standard cron has a minimum resolution of one minute because the scheduler only wakes up once per minute to check for due jobs. If you need sub-minute scheduling, use systemd timers with an OnCalendar directive for second-level precision, or an application-level scheduler like APScheduler, Celery Beat, or Sidekiq Scheduler that can handle intervals measured in seconds.
How can I test a cron expression before deploying it to production?
The safest approach is to use a visual cron builder that shows you the next several fire times in plain language so you can verify the schedule before it goes live. You can also use a cron parser library in Python or Node.js to generate future execution times programmatically. For jobs that run on a live server, temporarily change the schedule to run every minute during testing, confirm it works, then set the real interval.
Related Tools
Cron Expression Generator
Build and validate cron expressions visually without memorizing syntax.
Unix Timestamp Converter
Convert between human-readable dates and Unix timestamps for scheduling work.
Epoch Converter
Quickly decode epoch values to verify your scheduled job timing.
Regex Tester
Test patterns used to validate cron strings in your application code.