⏱️ Online Cron Expression Generator

Visual Cron expression editor with real-time execution preview and human-readable explanation

All processing happens locally in your browser — no data is uploaded to any server
Top Ad Slot (728×90)
Run at midnight every day
Minute0-59
Hour0-23
Day of Month1-31
Month1-12
Day of Week0-6 (Sun=0)

Next 5 Execution Times

Common Cron Expressions Cheat Sheet

ExpressionDescription
* * * * *Every minute
*/5 * * * *Every 5 minutes
0 * * * *Every hour
0 0 * * *Daily at midnight
0 9 * * 1Every Monday at 9AM
0 0 1 * *1st of every month
0 0 * * 1-5Every weekday at midnight
0 0,12 * * *Twice daily (midnight & noon)
0 0 1 1 *Every January 1st
0 0 * * 0Every Sunday at midnight
0 0 L * *Last day of every month
0 0 1-7 * 1First Monday of every month
Middle Ad Slot (728×90)

Tutorial

This Cron expression generator provides visual editing and real-time preview. Here's how to use it:

Select Format: The top of the page offers three format options: 5-field (standard Linux crontab), 6-field (with seconds, for Spring/Quartz), and 7-field (with year). Choose the format that matches your target scheduling system — the input area automatically adjusts the number of fields.

Visual Editing: Each Cron field (seconds, minutes, hours, day, month, weekday, year) has its own editing panel. You can directly type values, check multiple values, or use quick actions (select all, clear, invert). For example, checking 0, 15, 30, 45 in the "Minutes" field creates a schedule that runs every 15 minutes. The valid range is displayed below each field, and out-of-range values are highlighted in red.

Presets & Cheat Sheet: Click preset buttons to quickly load common expressions (e.g., "every minute," "daily at midnight," "every Monday"). The cheat sheet below lists the most common expressions with their meanings — click any row to load it into the editor.

Execution Preview: After editing, the preview table shows the next 5 execution times and their relative distances. If the expression is invalid, an error message appears. Once confirmed, click the copy button to copy the expression to your clipboard. The tool also generates a human-readable explanation, for example translating 0 9 * * 1-5 into "At 09:00, Monday through Friday."

Use Cases

Cron expressions are the universal language for scheduled task management. Here are key scenarios:

Linux System Administration: On Linux/Unix servers, crontab is the standard tool for managing recurring tasks. Sysadmins use Cron expressions for log rotation, data backups, system monitoring, and temp file cleanup. For example, 0 2 * * * runs a backup script daily at 2 AM.

Backend Service Development: Frameworks like Spring's @Scheduled annotation, Quartz Scheduler, and Elastic-Job all use Cron expressions. Developers need precise control over task timing, such as 0 0 9 * * MON for weekly reports every Monday at 9 AM, or 0 0 0 1 * ? for monthly settlement on the 1st at midnight.

Cloud-Native & DevOps: Kubernetes CronJob uses Cron expressions to schedule cluster tasks like data synchronization and resource cleanup. CI/CD pipelines (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). It was originally introduced at Bell Labs in Unix V7 around 1975. Initially supporting only 5 fields, the format gradually expanded to 6 fields (seconds) and 7 fields (year) with frameworks like Spring and Quartz.

Special Characters: Beyond the basic * (any), , (list), - (range), and / (step), some implementations support ? (no specific value, for day/weekday mutual exclusion), L (last, e.g., 0 0 L * * for the last day of month), W (nearest weekday), and # (nth occurrence, e.g., 0 0 0 ? * 2#1 for the first Monday of the month).

Implementation Differences: Different systems parse Cron differently. Linux crontab uses 5 fields with day-of-month and weekday in an "OR" relationship; Quartz uses 6-7 fields with an "AND" relationship (requiring ?); Spring's CronSequenceGenerator requires 6 fields where both 0 and 7 represent Sunday. Always consult your target system's documentation.

FAQ

What is a Cron expression?

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

What do the Cron expression fields mean?

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

How do I preview execution times?

After entering or editing a Cron expression in this tool, the "Next 5 Execution Times" section will display the next 5 trigger times in real-time, helping you verify the expression matches your expectations. Each time shows how long until it runs.

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

5-field Cron is the Unix/Linux standard (min hour day month weekday). 6-field Cron adds a "seconds" field at the start (sec min hour day month weekday), commonly used in Spring and Quartz. If your system doesn't support seconds, use the 5-field format.

Why might day-of-month and day-of-week not work as expected together?

In most Cron implementations, day-of-month and day-of-week are "OR" conditions, not "AND". That means the task runs if either condition is met. To require both, some systems (like Quartz) support the "?" placeholder. It's recommended to set one field and use * for the other.

What is the smallest interval Cron supports?

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

Bottom Ad Slot (728×90)

❓ 常见问题

⏱️ Online Cron Expression Generator有什么使用限制吗?

⏱️ Online Cron Expression Generator是免费在线工具,没有使用次数限制。由于采用纯前端处理,处理速度取决于你的设备性能。对于超大文件,建议分批处理以获得最佳体验。

⏱️ Online Cron Expression Generator支持手机端使用吗?

支持。⏱️ Online Cron Expression Generator采用响应式设计,可以在手机、平板和电脑上正常使用,界面会自动适配屏幕大小。

使用⏱️ Online Cron Expression Generator时数据会上传到服务器吗?

不会。⏱️ Online Cron Expression Generator采用纯前端技术,所有处理都在你的浏览器中完成,数据不会上传到任何服务器。即使断开网络,工具也能正常使用。

使用⏱️ Online Cron Expression Generator处理的数据安全吗?

安全。由于所有数据都在你的浏览器本地处理,不会经过任何服务器,因此不存在数据泄露的风险。你的数据始终在你的掌控之中。

⏱️ Online Cron Expression Generator需要安装软件吗?

不需要。⏱️ Online Cron Expression Generator是一个在线工具,直接在浏览器中打开网页即可使用,无需下载安装任何软件或插件。