⏲

Cron Expression Builder

Build and explain standard five-field cron expressions

Cron Expression Builder — what it does

Build a standard five-field cron expression by filling in minute, hour, day of month, month and day of week, and read back a plain-language explanation of exactly when the job will run. It removes the guesswork from a syntax where a single misplaced asterisk turns a monthly job into an hourly one.

Worked example

The default schedule plus three others typed into the five fields; the expression and the explanation update as you type.

Fields (minute, hour, day, month, weekday)ExpressionExplanation
0, 9, *, *, 1-5 (the defaults)0 9 * * 1-5minute 0; hour 9; every day of month; every month; weekday 1-5
30, 8, 1, *, *30 8 1 * *minute 30; hour 8; day of month 1; every month; every weekday
*/15, *, *, *, **/15 * * * *minute */15; every hour; every day of month; every month; every weekday
0, 18, *, 1,7, 50 18 * 1,7 5minute 0; hour 18; every day of month; month 1,7; weekday 5

The explanation only expands a bare * into "every …"; a step such as */15, a range or a list is repeated verbatim rather than put into words.

When this tool helps

  • Scheduling a backup, report or cache-warming job on a Linux server or in a CI pipeline.
  • Decoding an expression you inherited in a crontab and want to confirm before changing it.
  • Setting the schedule field in Kubernetes CronJobs, GitHub Actions or any scheduler using cron syntax.

How to use it

  1. Fill in the minute and hour fields.
  2. Set day of month, month and day of week, or leave asterisks for every value.
  3. Read the generated expression.
  4. Check the plain-language explanation before copying it.

Accuracy, limits, and good practice

  • Leaving minute as an asterisk means every minute of the matching hours — the single most common accidental cause of a runaway job.
  • When both day of month and day of week are restricted, standard cron runs on either match, not only when both are true.
  • Cron follows the server's time zone and, on many systems, does not adjust for daylight saving, so 02:30 jobs can be skipped or repeated.

Frequently asked questions

How do I run something every 15 minutes?

Use a step value in the minute field, written as */15. Steps also work in other fields, for example */2 in the hour field.

Does this support seconds?

No. The classic Unix format has five fields starting at minutes. Six-field variants with seconds exist in Quartz and some frameworks.

How can I test a schedule safely?

Point it at a script that only writes a log line, run it for a day, and confirm the timestamps match what the explanation promised.

Does the builder check that each field is valid?

No. The five values are joined with spaces exactly as typed, so a weekday of 8, a month of 13 or a typo such as 1-5x produces an expression the page labels normally but cron would reject. An empty field leaves a gap in the expression (for example " 18 * 1,7 5"), which is also invalid.

Can I type names such as MON or JAN?

You can, and they pass straight through into the expression (0 9 * * MON-FRI), but the explanation just echoes "weekday MON-FRI". Whether names are accepted depends on the cron that runs the job; standard cron takes three-letter English abbreviations for month and weekday.

Related tools on this site

Everything above runs inside this page. Cron Expression Builder needs no account, no upload, and no server round trip — close the tab and nothing is left behind.

Cron 表達式生成器能做什麼

依序填入分、時、日、月與星期五個欄位,即可組出標準的 cron 表達式,並讀到一段白話說明,清楚指出工作實際會在什麼時候執行。在這種放錯一個星號就會把「每月一次」變成「每小時一次」的語法裡,它能省去猜測。

實際範例

預設排程加上另外三組,依序填進五個欄位;表達式與說明會隨打字即時更新。

欄位(分、時、日、月、週)表達式說明
0, 9, *, *, 1-5(預設值)0 9 * * 1-5minute 0; hour 9; every day of month; every month; weekday 1-5
30, 8, 1, *, *30 8 1 * *minute 30; hour 8; day of month 1; every month; every weekday
*/15, *, *, *, **/15 * * * *minute */15; every hour; every day of month; every month; every weekday
0, 18, *, 1,7, 50 18 * 1,7 5minute 0; hour 18; every day of month; month 1,7; weekday 5

說明只會把單獨的 * 展開成「every …」;*/15 這類步進值、範圍與清單都是原樣照抄,不會翻成白話。

什麼時候用得上

  • 在 Linux 伺服器或 CI 流程中排定備份、報表或快取預熱工作。
  • 解讀接手來的 crontab 設定,修改前先確認它到底何時執行。
  • 設定 Kubernetes CronJob、GitHub Actions 等使用 cron 語法的排程欄位。

使用步驟

  1. 填入分鐘與小時欄位。
  2. 設定日、月與星期,或保留星號代表全部。
  3. 查看產生的表達式。
  4. 複製前先讀一次白話說明。

精確度、限制與實務建議

  • 分鐘欄留星號代表符合條件的每個小時內每分鐘都跑,這是工作暴衝最常見的意外原因。
  • 當「日」與「星期」同時被限制時,標準 cron 會在任一條件符合時執行,而非兩者都符合才執行。
  • cron 依伺服器時區執行,多數系統不會為日光節約時間調整,02:30 的工作可能被略過或執行兩次。

常見問題

每 15 分鐘執行一次怎麼寫?

在分鐘欄使用間隔值 */15。其他欄位同樣支援間隔,例如小時欄的 */2。

支援秒嗎?

不支援。傳統 Unix 格式是從分鐘開始的五個欄位;含秒的六欄變體見於 Quartz 與部分框架。

怎麼安全地測試排程?

先指向一個只寫入日誌的腳本,跑一天後核對時間戳是否與說明相符。

工具會檢核每個欄位是否合法嗎?

不會。五個值只是照打的內容以空格串起來,所以週欄填 8、月欄填 13 或打錯成 1-5x,頁面仍照常顯示,但 cron 會拒絕。欄位留空會在表達式裡留下空缺(例如「 18 * 1,7 5」),同樣不合法。

可以打 MON 或 JAN 這類名稱嗎?

可以,而且會原封不動進到表達式(0 9 * * MON-FRI),但說明只會照抄「weekday MON-FRI」。名稱能否被接受要看實際執行工作的 cron;標準 cron 對月份與星期接受三個字母的英文縮寫。

本站相關工具

以上步驟全部在這個頁面內完成,Cron 表達式生成器 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。