⏱️ Online Cron Expression Generator

Visual editor for Cron expressions with real-time execution preview and human-readable explanations

Pure client-side processing — data never leaves your browser
Ad Slot - Top (728×90)
Daily at midnight
Minute0-59
Hour0-23
Day of Month1-31
Month1-12
Day of Week0-6 (Sun=0)

Next 5 Execution Times Preview

Common Cron Expressions Cheat Sheet

Cron ExpressionDescription
* * * * *Every minute
*/5 * * * *Every 5 minutes
0 * * * *Every hour
0 0 * * *Daily at midnight
0 9 * * 1Every Monday at 9 AM
0 0 1 * *1st of month at midnight
0 0 * * 1-5Weekdays at midnight
0 0,12 * * *Midnight and noon daily
0 0 1 1 *Jan 1st at midnight
0 0 * * 0Sundays at midnight
0 0 L * *Last day of month at midnight
0 0 1-7 * 1First Monday of month
Ad Slot - Middle (728×90)

How to Use

This Cron expression generator provides visual editing and real-time preview. Here is the detailed usage guide:

Select Format: At the top of the page, toggle buttons let you switch between 5-field (standard Linux crontab), 6-field (with seconds, for Spring/Quartz), and 7-field (with year) formats. The input area automatically adjusts the number of fields based on the selected format.

Visual Editing: Each Cron field (second, minute, hour, day, month, weekday, year) has its own editing panel. You can directly input values, check multiple values, or use quick actions (Select All, Clear, etc.). For example, checking 0, 15, 30, 45 in the Minute field sets the expression to run every 15 minutes. Each field displays its valid range, and out-of-range values are highlighted in red.

Presets & Cheat Sheet: Click preset buttons to quickly fill in common expressions (e.g., "Daily at midnight", "Every hour", "Weekdays", etc.). The cheat sheet below lists the most common expressions and their meanings. Click any row to load it into the editor.

Execution Time Preview: After editing, the preview table displays the next 5 execution times along with the remaining time from now. If the expression is invalid, an error message is shown. Once confirmed, click the copy button to copy the expression to the clipboard. The tool also generates a human-readable English explanation, e.g. 0 9 * * 1-5 is explained as "Every minute, every hour, day of week 1-5, every month".

Use Cases

Cron expressions are the universal language of scheduled task management. Here are the core use cases:

Linux System Administration: On Linux/Unix servers, crontab is the standard tool for managing scheduled tasks. Administrators use Cron expressions to configure log rotation, data backup scripts, system monitoring checks, and periodic cleanup of temporary files. For example, 0 2 * * * means "run backup every day at 2 AM".

Backend Service Development: Spring's @Scheduled annotation, Quartz scheduler, Elastic-Job, and other scheduling frameworks all use Cron expressions to define execution cycles. Developers often need precise control over task timing, such as 0 0 9 * * MON for "generate weekly report every Monday at 9 AM", or 0 0 0 1 * ? for "run monthly settlement on the 1st of each month at midnight".

Cloud Native & DevOps: Kubernetes CronJob uses Cron expressions to schedule periodic tasks in the cluster, such as regular data synchronization and cleanup of expired resources. CI/CD pipelines (e.g., GitLab CI scheduled pipelines, Jenkins timed builds) also rely on Cron expressions to trigger automated workflows.

Extended Knowledge

Origin of Cron: The name "Cron" comes from the Greek word "Chronos" (time), first introduced by Bell Labs in Unix V7 in 1975. It originally supported only a 5-field format. With the development of Spring, Quartz, and other frameworks, it gradually expanded to 6-field (second) and 7-field (year) formats.

Special Characters: Beyond the basic * (any), , (list), - (range), and / (step), some implementations also support ? (unspecified, used when day and weekday are mutually exclusive), L (last, e.g. 0 0 L * * means the last day of each month), W (nearest weekday), # (nth occurrence, e.g. 0 0 0 ? * 2#1 means the first Monday of each month), and other advanced features.

Implementation Differences: Different systems interpret Cron differently. Linux crontab uses 5 fields with an logical OR between day and weekday. Quartz uses 6-7 fields with an AND relationship (requiring ? as a placeholder). Spring's Cron serializer requires 6 fields and treats both 0 and 7 as Sunday in the weekday field. Choose the appropriate format for your target system and consult its documentation.

FAQ

What is a Cron expression?

A Cron expression is a string format used to define when scheduled tasks should run, widely used in Linux crontab, Spring Scheduler, Quartz, Kubernetes CronJob, and other systems. It consists of 5 or 6 fields representing minute, hour, day of month, month, day of week (and optionally second and year).

What do the Cron expression fields mean?

The standard 5-field Cron format is "minute hour day month weekday". The 6-field format adds a "second" field at the beginning. The 7-field format adds a "year" field at the end. Special characters include: * (any), , (list), - (range), / (step). For example, "*/5" means every 5 units.

How do I preview Cron expression execution times?

In this tool, after entering or editing a Cron expression, the "Next 5 Execution Times Preview" area displays the next 5 trigger times in real time, helping you confirm whether the expression matches your expectations. Each execution time also shows the remaining time from now.

What is the difference between 6-field and 5-field Cron expressions?

5-field Cron is the standard Unix/Linux format (minute hour day month weekday). 6-field Cron adds a "second" field at the beginning (second minute hour day month weekday), commonly found in Spring framework and Quartz scheduler. If your system does not support the second field, use the 5-field format.

Why might the expression not execute as expected when both day and weekday are set?

In most Cron implementations, the day of month and day of week fields have an "OR" relationship rather than "AND". This means the task runs if either condition is met. If you need both conditions to be satisfied, some systems (like Quartz) support the "?" placeholder. We recommend setting only one of these fields and using * for the other.

What is the minimum time interval supported by Cron?

Standard 5-field Cron supports a minimum interval of 1 minute. With the 6-field format (including seconds), the minimum interval can be 1 second. However, the actual minimum interval also depends on the scheduler implementation: Linux crontab supports minute-level precision, while Java Quartz and Spring Task support second-level scheduling.

Ad Slot - Bottom (728×90)