The team behind OnlineTools4Free — building free, private browser tools.
Published Mar 15, 2026 · 7 min read · Reviewed by OnlineTools4Free
Cron Expressions Explained: Schedule Like a Pro
What Is Cron?
Cron is the time-based job scheduler found on Unix and Linux systems. It runs tasks (called cron jobs) at specified intervals — backups at midnight, log rotation every Sunday, report emails every Monday at 9 AM. The schedule is defined using a cron expression, a compact string of five fields that describes when the job should fire.
Cron has been part of Unix since 1975, and the expression syntax is now used far beyond Unix systems. Kubernetes CronJobs, GitHub Actions schedules, AWS EventBridge, CI/CD pipelines, and countless libraries in every programming language use the same format.
The Five-Field Format
A standard cron expression has five fields separated by spaces:
minute hour day-of-month month day-of-week
- Minute: 0-59
- Hour: 0-23
- Day of month: 1-31
- Month: 1-12 (or JAN-DEC)
- Day of week: 0-7 (0 and 7 are both Sunday, or SUN-SAT)
Example: 30 9 * * 1-5 means "at 9:30 AM, every day of every month, but only Monday through Friday."
Special Characters
Cron's power comes from its special characters:
- Asterisk (*): Matches every possible value.
* * * * *runs every minute. - Comma (,): Lists multiple values.
0 9,12,17 * * *runs at 9 AM, noon, and 5 PM. - Hyphen (-): Defines a range.
0 9-17 * * *runs every hour from 9 AM to 5 PM. - Slash (/): Defines a step.
*/15 * * * *runs every 15 minutes.0 */2 * * *runs every 2 hours.
Some implementations (like Quartz for Java) add a sixth field for seconds and support characters like L (last day of month), W (nearest weekday), and # (nth weekday). Standard Unix cron does not support these.
Common Schedules
Here are cron expressions you will reach for regularly:
0 0 * * *— Midnight every day (daily backup)0 */6 * * *— Every 6 hours (cache refresh)30 2 * * 0— 2:30 AM every Sunday (weekly maintenance)0 9 1 * *— 9 AM on the 1st of every month (monthly report)*/5 * * * *— Every 5 minutes (health check)0 8 * * 1-5— 8 AM on weekdays (morning notification)0 0 1 1 *— Midnight on January 1st (yearly task)15,45 * * * *— At :15 and :45 of every hour
Many systems also support shorthand aliases: @hourly (= 0 * * * *), @daily (= 0 0 * * *), @weekly (= 0 0 * * 0), @monthly (= 0 0 1 * *), @yearly (= 0 0 1 1 *).
Common Pitfalls
- Timezone confusion: Cron runs in the system's timezone (or the timezone configured in the cron daemon). A server in UTC and a developer in EST will have a 5-hour difference. Always document which timezone your cron uses.
- Day-of-month vs day-of-week: When you set both fields, most cron implementations run the job when either condition matches, not when both match.
0 9 15 * 1runs on the 15th and every Monday, not only on Mondays that fall on the 15th. - February 31st:
0 0 31 2 *will never fire. Cron silently skips impossible dates — there is no error. - Overlapping runs: If a job takes longer than the interval, the next run starts while the previous is still running. Use a lock file or a tool like
flockto prevent overlaps. - Missing PATH: Cron runs with a minimal environment. Commands that work in your terminal may fail in cron because the PATH is different. Use full paths to executables.
Build Cron Expressions Visually
Rather than memorizing syntax, use our Cron Expression Generator to build expressions visually. Select the schedule you want, see the cron expression update in real time, and verify the next run times before deploying. Everything runs in your browser.
Cron Expression Generator
Build cron schedules visually with human-readable descriptions and next run times.
OnlineTools4Free Team
The OnlineTools4Free Team
We are a small team of developers and designers building free, privacy-first browser tools. Every tool on this platform runs entirely in your browser — your files never leave your device.
