Part of: Developer Utilities HubVisit Hub
Cron Parser Learning Path

Cron Expressions Explained

Last Reviewed: June 2026

Learn how Cron expressions work, understand every scheduling field, create common Cron schedules, and avoid the most common Cron expression mistakes.

Quick Answer: This guide thoroughly explores the technical concepts and practical applications regarding Cron Expressions Explained. It provides clear instructions and actionable examples to help you fully understand the topic and integrate it into your development workflow without relying on external server dependencies.

Software developers frequently need to run tasks automatically. Whether you're scheduling database backups, generating daily reports, syncing data between APIs, performing cache cleanup, or rotating logs, automation is essential for reliable systems.

The industry standard mechanism for defining these time-based schedules is the Cron expression.

Cron Expressions at a Glance
  • Cron schedules recurring tasks.
  • Traditional Cron expressions use five primary fields.
  • Each field represents part of a schedule.
  • * means all allowed values in a field.
  • / represents intervals/steps.
  • - represents ranges.
  • , represents lists.
  • Cron behavior can vary between implementations.
  • Always test Cron expressions before deploying them.

Parse and Understand Cron Expressions Instantly

Writing Cron expressions manually can be error-prone, especially when schedules become complex. The UnixlyTools Cron Parser lets developers enter an expression and immediately understand what each field means.

What Is Cron?

Cron is a time-based job scheduler commonly found in Unix and Unix-like operating systems. The cron daemon runs continuously in the background, checking a configuration table (the crontab) to see if any scheduled tasks are due to run in the current minute.

TermMeaning
CronScheduling system
Cron daemonService that executes scheduled jobs
Cron expressionSchedule definition
Cron jobCommand/task scheduled to run
crontabConfiguration containing scheduled jobs

This distinction is important because while "Cron" refers to the system, developers usually interact directly with "Cron expressions" to define the rules for their jobs.

What Is a Cron Expression?

A Cron expression describes when a scheduled task should run. It is a compact string of fields separated by spaces.

For example:

*/5 * * * *

In a standard five-field Cron interpretation, this expression translates to:

"Every 5 minutes"

Cron Expression Syntax

The standard Cron format consists of five fields. Here is the visual structure:

* * * * * │ │ │ │ │ │ │ │ │ └── Day of week │ │ │ └──── Month │ │ └────── Day of month │ └──────── Hour └────────── Minute

Understanding the Five Cron Fields

Minute

Range: 0–59

The exact minute(s) of the hour the job will run.

# Examples *       (Every minute) 0       (At minute 0) 15      (At minute 15) */5     (Every 5 minutes) 1,15,30 (At minutes 1, 15, and 30) 1-10    (Every minute from 1 to 10)

Hour

Range: 0–23

The exact hour(s) of the day. Uses a 24-hour clock.

# Examples *       (Every hour) 0       (Midnight) 12      (Noon) */2     (Every 2 hours) 9-17    (Every hour between 9 AM and 5 PM)

Day of Month

Typical Range: 1–31

The specific day of the month. Note that valid values depend on the actual month (e.g., February has 28/29 days).

Month

Typical Range: 1–12

The specific month of the year. Some Cron implementations also support three-letter month names (JAN, FEB, etc.).

# Examples 1       (January) 6       (June) 12      (December) 1,6,12  (January, June, and December)

Day of Week

Typical Range: 0–7

The day of the week. In many common Unix implementations, 0 represents Sunday. Often, 7 also represents Sunday. Some implementations support names:

MON TUE WED THU FRI SAT SUN
Implementation Differences
Always verify if your specific environment supports three-letter names or how it treats 0 vs 7. Standard numerical ranges (0-6) are the safest for cross-platform compatibility.

Cron Field Reference Table

FieldAllowed ValuesExample
Minute0–59*/5
Hour0–239
Day of month1–311
Month1–126
Day of week0–7MON

Cron Special Characters

Cron expressions use special characters to define advanced scheduling logic beyond single values.

* Wildcard

Meaning: All allowed values for that field.

* * * * *

/ Step

Meaning: Defines step values/intervals.

*/5 * * * *

Runs every five minutes.

- Range

Meaning: Defines a contiguous range of values.

0 9-17 * * *

Runs at minute 0 past every hour from 9 (9 AM) to 17 (5 PM).

, List

Meaning: Specifies multiple individual values.

0 9,12,18 * * *

Runs exactly at 9:00 AM, 12:00 PM, and 6:00 PM.

Combination

You can combine these characters for complex logic.

*/15 9-17 * * MON-FRI

Every 15 minutes, between 9 AM and 5 PM, Monday through Friday.

SymbolMeaningExample
*Any allowed value*
/Step/interval*/5
-Range9-17
,List9,12,18

How to Read a Cron Expression

The easiest way to read a Cron expression is step-by-step from left to right: Minute → Hour → Day of Month → Month → Day of Week.

Take this expression:

30 9 * * 1-5

Let's break it down:

  • Minute: 30 (At minute 30)
  • Hour: 9 (At hour 9, which is 9 AM)
  • Day of Month: * (Every day)
  • Month: * (Every month)
  • Day of Week: 1-5 (Monday through Friday)

Therefore, the final human-readable schedule is:

"Runs at 9:30 AM, Monday through Friday."

Common Cron Expression Examples

Every minute

* * * * *

Every 5 minutes

*/5 * * * *

Every 10 minutes

*/10 * * * *

Every 15 minutes

*/15 * * * *

Every 30 minutes

*/30 * * * *

Every hour

0 * * * *

Every 2 hours

0 */2 * * *

Every day at midnight

0 0 * * *

Every day at 9 AM

0 9 * * *

Every weekday at 9 AM

0 9 * * 1-5

Every Monday at midnight

0 0 * * 1

First day of every month at midnight

0 0 1 * *

Every Sunday at midnight

0 0 * * 0

Twice a day (9 AM and 6 PM)

0 9,18 * * *

How to Create a Cron Expression

Building a Cron expression follows a simple, repeatable 7-step process.

Step 1: Determine the minute

Do you need to run it every minute (*), a specific minute (e.g., 30), or an interval (*/15)?

Step 2: Determine the hour

Are there specific hours required? E.g., 2 AM (2) or business hours (9-17).

Step 3: Determine the day of month

Does it need to be a specific date, like the 1st of the month (1)? Or every day (*)?

Step 4: Determine the month

Is this a yearly job (e.g., January = 1), or should it run every month (*)?

Step 5: Determine the day of week

Are weekends excluded? If so, use 1-5 (Mon-Fri) instead of *.

Step 6: Combine the fields

Join them with spaces in the standard order.

Step 7: Test the expression

Always use a parser to verify you didn't accidentally schedule a job to run thousands of times.

Practical Developer Schedules

Database Backup

Requirement: Daily at 2 AM during low traffic.

0 2 * * *

Minute 0, Hour 2, every day.

Log Cleanup

Requirement: Every Sunday at 3 AM.

0 3 * * 0

Minute 0, Hour 3, Day of Week 0 (Sunday). Caveat: Ensure your server resolves 0 as Sunday.

API Synchronization

Requirement: Every 15 minutes.

*/15 * * * *

Uses the step operator on the minute field.

Report Generation

Requirement: Every weekday at 8 AM.

0 8 * * 1-5

Minute 0, Hour 8, Days 1-5 (Mon-Fri).

Monthly Billing Process

Requirement: First day of every month at midnight.

0 0 1 * *

Caveat: If your job relies on monthly data, ensure it processes the previous month's data.

Advanced Cron Expressions

Weekday business hours

*/15 9-17 * * 1-5

Every 15 minutes between 9 AM and 5 PM, Monday through Friday.

Multiple specific hours

0 9,13,18 * * *

Exactly at 9 AM, 1 PM, and 6 PM every day.

Specific months (Quarterly)

0 9 1 1,4,7,10 *

At 9:00 AM on the 1st day of January, April, July, and October.

Cron Day-of-Month and Day-of-Week Behavior

This is one of the most confusing aspects of standard Cron behavior. Let's look at this expression:

0 9 1 * MON

You might assume this means: "Run at 9 AM on the 1st of the month, but only if it is a Monday."

However, traditional Cron implementations treat the day-of-month and day-of-week fields with an OR-style relationship when both are restricted (i.e., when neither is *).

Crucial Behavior
In most standard Cron systems, 0 9 1 * MON means: "Run at 9 AM on the 1st of the month OR on every Monday." It will run on the 1st, and it will run on every Monday.

Always test complex day matching. Note that behavior can vary by implementation—some custom schedulers might treat it as an AND relationship.

Cron Time Zones and Scheduling

A Cron expression describes a time, but it does not inherently mean "your local time." Cron schedules run according to the environment's configured time zone.

  • Server timezone: By default, Linux cron uses the system timezone.
  • Containers: Docker containers often default to UTC unless specifically configured.
  • Cloud Schedulers: AWS EventBridge, GCP Cloud Scheduler, etc., usually allow you to define the timezone along with the expression.

Daylight Saving Time (DST)

If your server uses a local timezone (like EST or PST), Daylight Saving Time will cause massive problems:

  • Missing times: When clocks spring forward (e.g., from 1:59 AM to 3:00 AM), jobs scheduled between 2:00 AM and 2:59 AM will not run at all.
  • Repeated times: When clocks fall back (e.g., from 2:59 AM back to 2:00 AM), jobs scheduled in that hour will run twice.
Best Practice
For critical workloads, always configure your server or container timezone to UTC. UTC does not observe Daylight Saving Time, guaranteeing consistent daily execution.

Standard Cron vs Quartz Cron

Cron syntax is not perfectly universal. The two most common variants you will encounter are standard Unix Cron and Quartz Scheduler (commonly used in Java ecosystems).

Standard Cron (5 fields):

0 9 * * *

Quartz Cron (6 or 7 fields):

0 0 9 * * ?
FeatureStandard CronQuartz
Typical fields56 or 7
Seconds fieldUsually noYes
? special fieldUsually noYes
Typical environmentUnix/Linux, KubernetesJava scheduling ecosystem, Spring
Syntax compatibilityNot universalNot universal
Warning
Never assume a Cron expression written for one scheduler will work unchanged in another. Copying a Quartz expression with a ? into a standard Linux crontab will fail.

Common Cron Mistakes

Avoid these frequent developer pitfalls:

  1. Miscounting the five fields: Accidentally providing 4 or 6 fields in a standard Cron setup.
  2. Confusing minute and hour: Writing * 0 * * * (every minute of midnight) instead of 0 * * * * (top of every hour).
  3. Using seconds in standard Cron: Standard Cron does not support seconds. The first field is Minute.
  4. Assuming Cron uses local time: Cron uses the execution environment's timezone.
  5. Forgetting timezone configuration: Not explicitly setting the timezone in cloud schedulers.
  6. Misunderstanding */5: Thinking it means "exactly 5 minutes from now" instead of "on minutes divisible by 5" (e.g., 10, 15, 20).
  7. Confusing ranges and lists: Using 9,17 (9 AM and 5 PM) when you meant 9-17 (9 AM to 5 PM).
  8. Incorrect day-of-week numbering: Forgetting if your system uses 0 or 7 for Sunday.
  9. Ignoring day-of-month/day-of-week semantics: Forgetting the OR-relationship (e.g., 0 0 1 * MON).
  10. Copying Quartz syntax into standard Cron: Using the ? character where it isn't supported.
  11. Forgetting DST behavior: Scheduling a critical job at 2:30 AM on a server using local time.
  12. Not testing schedules: Deploying complex expressions without validating them in a Cron parser first.
  13. Assuming every Cron implementation is identical: Kubernetes, Vixie Cron, BusyBox, and Jenkins all have slight variations.
  14. Running expensive jobs too frequently: Creating overlapping executions because the job takes longer than the interval.
  15. Forgetting overlapping executions: Not implementing lock files for jobs that cannot safely run concurrently.
  16. Not logging Cron job output: Failing to redirect stdout and stderr, meaning failures fail silently.
  17. Using relative paths: Cron usually runs in a restricted shell. Always use absolute paths to scripts and files.
  18. Assuming environment variables are identical: Cron does not load your full user profile (e.g., .bashrc). PATH variables might be missing.
  19. Ignoring permissions: The cron daemon runs as a specific user; ensure that user has execute permissions.
  20. Not accounting for server/container timezone: Migrating a container to a different cloud region and accidentally changing schedule times.

Cron Best Practices (Reliability and Security)

A correct Cron expression does not guarantee a reliable job. Follow these operational best practices:

  • Keep expressions readable: If it's overly complex, consider running it more frequently and handling the time logic inside the script itself.
  • Comment complex schedules: Always add a plain-English comment above your crontab entry.
  • Test expressions before production: Use a Cron Parser to visualize upcoming dates.
  • Document timezone assumptions: Clearly state in documentation if the schedule expects UTC.
  • Use absolute paths where appropriate: Never rely on ./script.sh in a crontab.
  • Capture logs: Always redirect output (e.g., > /var/log/myjob.log 2>&1).
  • Make jobs idempotent: A job should be safe to run twice accidentally without causing data corruption.
  • Prevent overlapping executions: If a job runs every 5 minutes but takes 10 minutes, multiple instances will run simultaneously. Use lock files, job queues, or distributed locks to prevent this.
  • Avoid sensitive data in command arguments: Do not pass passwords directly in the crontab command line (e.g., --password=secret), as they can be seen in process lists. Use environment variables or secure credential stores.

How to Test a Cron Expression

Never deploy a complex Cron expression directly to production without verifying it.

Using the UnixlyTools Cron Parser, you can type your expression and immediately see:

  • A plain-English description of the schedule.
  • A breakdown of each individual field.
  • A list of the next upcoming execution dates (to verify it matches your intent).

Parse and Understand Cron Expressions Instantly

Enter any Cron expression into the UnixlyTools Cron Parser to understand its schedule, inspect each field, and verify that your scheduling rule works as expected.

Open Cron Parser

Frequently Asked Questions

What is a Cron expression?

A Cron expression is a string consisting of five (or sometimes six) fields separated by white space that represents a set of times, normally as a schedule to execute a routine.

What does * * * * * mean?

The expression `* * * * *` means that the scheduled task will run every single minute of every hour, every day of the month, every month, and every day of the week.

What are the five fields in a Cron expression?

The five standard Cron fields from left to right represent: Minute (0-59), Hour (0-23), Day of Month (1-31), Month (1-12), and Day of Week (0-7).

What does */5 * * * * mean?

This expression uses the step operator (/) to specify execution every 5 minutes.

How do I run a Cron job every minute?

To run a Cron job every minute, use the expression `* * * * *`.

How do I run a Cron job every 5 minutes?

Use `*/5 * * * *` to run a task every 5 minutes.

How do I run a Cron job every hour?

To run a Cron job at the beginning (minute 0) of every hour, use `0 * * * *`.

How do I run a Cron job every day?

To run a Cron job every day at a specific time, like midnight, use `0 0 * * *`.

How do I run a Cron job at midnight?

The expression `0 0 * * *` represents midnight (minute 0, hour 0) every day.

How do I run a Cron job every Monday?

Use `0 0 * * 1` to run a job at midnight every Monday.

How do I schedule a Cron job on weekdays?

To run a job on weekdays (Monday through Friday), use the expression `0 0 * * 1-5` (assuming midnight execution).

What does * mean in Cron?

The asterisk (*) is a wildcard that means 'every allowed value'. For example, an asterisk in the hour field means 'every hour'.

What does / mean in Cron?

The forward slash (/) represents a step value. For example, `*/15` in the minute field means 'every 15 minutes'.

What does - mean in Cron?

The hyphen (-) defines a range of values. For example, `9-17` in the hour field means 'every hour from 9 AM to 5 PM'.

What does , mean in Cron?

The comma (,) separates items in a list. For example, `MON,WED,FRI` in the day of week field means 'Monday, Wednesday, and Friday'.

What is crontab?

Crontab (cron table) is a configuration file that contains the list of Cron jobs to be executed by the cron daemon, along with their schedule expressions.

What is the difference between Cron and a Cron job?

Cron is the time-based job scheduler service/daemon itself, while a Cron job is a specific task or command scheduled to run within that system.

What is the difference between Cron and Quartz?

Standard Cron uses 5 fields and operates primarily in Unix/Linux. Quartz is a Java-based scheduler that often uses 6 or 7 fields (adding seconds and optional year) with different special characters.

Does Cron use local time?

Cron uses the timezone configured for the execution environment (server, container, or cloud scheduler). By default, this is often the server's local time, but it should ideally be configured to UTC to avoid Daylight Saving Time issues.

Can Cron expressions use seconds?

Standard Unix Cron expressions do not support seconds. However, extensions like Quartz or specific CI/CD schedulers do support a 6-field format where the first field represents seconds.

Why is my Cron job not running?

Common reasons include syntax errors in the Cron expression, incorrect file paths, permissions issues, missing environment variables, or timezone misunderstandings.

How do I test a Cron expression?

You can test a Cron expression using an online Cron parser to translate the syntax into human-readable schedules and upcoming execution dates.

Can I use Cron expressions in Kubernetes?

Yes, Kubernetes CronJobs use standard 5-field Cron syntax to schedule Jobs within the Kubernetes cluster.

Can Cron jobs overlap?

Yes. If a Cron job is scheduled to run every 5 minutes but takes 10 minutes to complete, a new instance will start before the previous one finishes unless concurrency controls (like lock files) are implemented.

What timezone does Cron use?

Cron relies on the timezone of the server or container where the cron daemon is running unless a specific timezone variable (like CRON_TZ) is explicitly set in the crontab.

How do I write a Cron expression?

Determine the required minute, hour, day of month, month, and day of week. Use wildcards (*), ranges (-), lists (,), and steps (/) to build the condition for each field.

What is the best way to validate a Cron expression?

The best way is to use a visual Cron expression parser or generator tool that breaks down each field and shows upcoming scheduled times to confirm your logic.