Back to Blog
Tools13 min read

Cron Expression Generator: How to Build Any Schedule

Cron expressions look cryptic until you understand the pattern. Five fields, a handful of special characters, and you can describe virtually any recurring schedule. This guide walks through every field and character using CronJobPro's free cron expression generator as a learning tool. By the end, you will be able to write cron expressions from memory.

The Five Fields

A cron expression is a string of five values separated by spaces. Each value controls one dimension of "when" the job runs:

┌─────────── minute       (0-59)
│ ┌───────── hour         (0-23)
│ │ ┌─────── day of month (1-31)
│ │ │ ┌───── month        (1-12 or JAN-DEC)
│ │ │ │ ┌─── day of week  (0-7 or SUN-SAT, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *

The fields are evaluated together. A job runs when all five fields match the current time. The one exception: day-of-month and day-of-week are joined with OR, not AND. If you set both, the job runs when either matches.

Open the cron generator in another tab to follow along as we build expressions.

Field-by-Field Walkthrough

Minute (0-59)

The minute within the hour when the job fires. This is the most commonly customized field because it controls the exact timing of most schedules.

0  * * * *    # At minute 0 (top of every hour)
30 * * * *    # At minute 30 (half past every hour)
15 * * * *    # At minute 15
0,30 * * * *  # At minutes 0 and 30 (twice per hour)
*/5 * * * *   # Every 5 minutes (0, 5, 10, 15, ... 55)
5-10 * * * *  # Every minute from :05 through :10

Hour (0-23)

The hour in 24-hour format. Hour 0 is midnight, hour 12 is noon, hour 23 is 11 PM.

0 9 * * *     # At 9:00 AM
0 0 * * *     # At midnight (00:00)
0 */2 * * *   # Every 2 hours (0:00, 2:00, 4:00, ...)
0 9-17 * * *  # Every hour from 9 AM to 5 PM
0 9,12,18 * * *  # At 9 AM, noon, and 6 PM

Day of Month (1-31)

Which day of the month. Be careful with values above 28 — not every month has 29, 30, or 31 days. If you schedule for the 31st, the job will not run in months with fewer days.

0 0 1 * *     # First of every month at midnight
0 0 15 * *    # 15th of every month at midnight
0 0 1,15 * *  # 1st and 15th of every month
0 0 */7 * *   # Every 7 days starting from the 1st

Month (1-12 or JAN-DEC)

Most jobs run every month (using *). But you can restrict to specific months for seasonal or quarterly tasks:

0 0 1 1 *        # January 1st at midnight (New Year)
0 0 1 */3 *      # First of every 3rd month (Jan, Apr, Jul, Oct)
0 0 1 1,4,7,10 * # Same: quarterly on the 1st
0 9 * 6-8 *      # Daily at 9 AM, but only June through August

Day of Week (0-7 or SUN-SAT)

Both 0 and 7 represent Sunday. Values 1-6 are Monday through Saturday. You can use three-letter abbreviations (SUN, MON, TUE, etc.) for readability:

0 9 * * 1       # Every Monday at 9 AM
0 9 * * MON     # Same thing — Monday at 9 AM
0 9 * * 1-5     # Weekdays at 9 AM
0 9 * * MON-FRI # Same: weekdays at 9 AM
0 0 * * 0       # Every Sunday at midnight
0 0 * * 6,0     # Every Saturday and Sunday at midnight

For a ready-made collection of weekday and weekend schedules, see our cron expression examples.

Special Characters Explained

Beyond simple numbers, cron expressions use several special characters. Here is the complete reference:

CharacterNameMeaningExample
*WildcardEvery possible value* * * * * (every minute)
/StepEvery Nth value*/15 * * * * (every 15 min)
,ListMultiple specific values0 9,12,18 * * * (3 times/day)
-RangeInclusive range of values0 9-17 * * * (9 AM to 5 PM)
LLastLast day of month/week0 0 L * * (last day of month)
WWeekdayNearest weekday to given day0 0 15W * * (weekday nearest 15th)
#NthNth occurrence of a weekday0 9 * * 1#2 (2nd Monday)

Compatibility note: The L, W, and # characters are extensions supported by Quartz, Spring, and some cron services (including CronJobPro). Standard Unix cron and most platform crons (Vercel, GitHub Actions) only support * / , -. The generator tool shows which characters are supported for each platform.

Combining Characters: The Step Trick

The step character (/) is more flexible than most people realize. You can combine it with a starting value or a range:

# */15 means "every 15, starting from 0"
# This runs at :00, :15, :30, :45
*/15 * * * *

# 5/15 means "every 15, starting from 5"
# This runs at :05, :20, :35, :50
5/15 * * * *

# 10-30/5 means "every 5, starting from 10, up to 30"
# This runs at :10, :15, :20, :25, :30
10-30/5 * * * *

# Combine with ranges in other fields:
# Every 10 minutes during business hours on weekdays
*/10 9-17 * * 1-5

This is particularly useful for staggering jobs. If you have three jobs that all run "every 15 minutes," starting them at minute 0, 5, and 10 prevents them from hitting your server simultaneously.

20 Common Patterns

Here are the most frequently needed cron expressions. Each links to a detailed explanation page:

ExpressionDescription
* * * * *Every minute
*/5 * * * *Every 5 minutes
*/15 * * * *Every 15 minutes
*/30 * * * *Every 30 minutes
0 * * * *Every hour
0 */2 * * *Every 2 hours
0 */6 * * *Every 6 hours
0 0 * * *Daily at midnight
0 9 * * *Daily at 9 AM
0 9 * * 1-5Weekdays at 9 AM
0 0 * * 0Every Sunday at midnight
0 0 * * 1Every Monday at midnight
0 0 1 * *First of every month
0 0 1 1 *January 1st (yearly)
0 0 1 */3 *Every quarter
0 9,17 * * 1-5Weekdays at 9 AM and 5 PM
0 0 1,15 * *1st and 15th of each month
30 4 * * *Daily at 4:30 AM
0 */4 * * *Every 4 hours
0 0 * * 6,0Weekends at midnight

Not finding your pattern? Use the visual cron generator to build custom expressions, or browse the full cron expression library with 50+ examples.

Using the CronJobPro Generator: Step by Step

The CronJobPro cron expression generator is a free tool that lets you build expressions visually. Here is how to use it:

Step 1: Choose a Preset or Start from Scratch

The generator offers common presets (every minute, every hour, daily, weekly, monthly) as starting points. Click one to populate all five fields, then customize from there. Or leave all fields at * and build your expression from scratch.

Step 2: Set Each Field

For each of the five fields, you can select from a dropdown or type the value directly. The generator validates your input in real time and shows an error if the expression is invalid. Fields can accept any combination of numbers, lists, ranges, and steps.

Step 3: Preview Next Execution Times

As you modify each field, the generator instantly shows the next 5-10 execution times. This is the fastest way to verify your expression does what you expect. Pay attention to edge cases: does it fire at the right time on the last day of the month? Does it correctly skip weekends?

Step 4: Copy and Use

Click the copy button to grab the expression. Paste it into your crontab, your CronJobPro job configuration, your CI/CD pipeline, or wherever you need it. The expression is a standard 5-field format compatible with all major cron implementations.

Testing Your Expression

Before deploying a cron expression to production, verify it by checking these things:

  1. Preview execution times. The generator shows upcoming runs. Scan through at least 10 to catch patterns. A common mistake is writing an expression that fires at 2 AM every day when you meant every Monday.
  2. Check timezone behavior. If your cron system uses UTC (like Vercel or GitHub Actions), make sure the hour value accounts for your local offset. "9 AM London" is hour 9 in winter (UTC+0) but hour 8 in summer (UTC+1).
  3. Test edge cases. What happens on February 28/29? On months with 30 vs 31 days? If your expression uses day-of-month 31, it will silently skip months without a 31st day.
  4. Verify frequency. Calculate the total number of executions per day or per month. An expression like */1 * * * * runs 1,440 times per day. Make sure your endpoint and budget can handle the volume.

Predefined Schedule Strings

Some cron implementations support shorthand strings as alternatives to the five-field format. These are not universally supported, but they are convenient when available:

ShorthandEquivalentMeaning
@yearly / @annually0 0 1 1 *January 1st at midnight
@monthly0 0 1 * *1st of every month at midnight
@weekly0 0 * * 0Every Sunday at midnight
@daily / @midnight0 0 * * *Every day at midnight
@hourly0 * * * *Every hour at minute 0
@rebootn/aOnce at startup (Unix cron only)

When in doubt, use the five-field format. It works everywhere and leaves no room for ambiguity.

5 Mistakes That Trip Up Everyone

  1. Forgetting that */N starts from 0. */10 * * * * runs at :00, :10, :20, :30, :40, :50 — not starting from the current minute. If you create the job at 3:17, the first execution is still at 3:20.
  2. Confusing day-of-month and day-of-week. 0 0 5 * 1 does not mean "the 5th if it is a Monday." It means "the 5th of the month OR any Monday." These fields use OR logic, not AND.
  3. Using 24 for midnight. Hours go from 0 to 23. There is no hour 24. Midnight is hour 0.
  4. Assuming timezone awareness. Most cron systems use the server's timezone or UTC. If you schedule a job for hour 9 thinking "9 AM my time" on a UTC server, it will run at 9 AM UTC, which might be 4 AM your time.
  5. Leaving all fields as *. * * * * * runs every single minute. That is 1,440 times per day. Make sure you actually need that frequency before deploying it.

From Expression to Scheduled Job

Once you have your cron expression, you need somewhere to run it. Here are the main options:

OptionBest ForLimitations
Linux crontabShell scripts on a server you manageNo monitoring, no retries, server-dependent
Vercel CronNext.js apps on Vercel2 jobs (free), UTC only, no retries
AWS LambdaCompute-heavy tasks in AWS15 min limit, cold starts, config overhead
GitHub ActionsCI/CD-related schedulesDelayed start (up to 20 min), no SLA
CronJobProHTTP-based scheduled tasksRequires an HTTP endpoint to call

For most web applications, the scheduled task is already an API route or webhook endpoint. In that case, CronJobPro is the simplest path: paste your cron expression, enter your URL, and the job is live with monitoring and retries included.

Key Takeaways

  • Cron expressions use 5 fields: minute, hour, day-of-month, month, day-of-week.
  • Core special characters: * (any), / (step), , (list), - (range).
  • Extended characters L, W, # are supported by some systems but not all.
  • Always preview execution times before deploying, especially for complex expressions.
  • The CronJobPro generator is free and requires no signup.

Related Articles

Build your cron expression now

Use the free visual generator to create and test your expression, then schedule it with CronJobPro in under 2 minutes.