📚 Developer · Guide

How to Write a Cron Expression (With a Free Cron Builder)

Build cron schedules without memorising the syntax and read any cron expression in plain English. Includes the five fields, special characters, ready-made examples and timezone tips.

By RexBD Team 24 Nov 2026 7 min read 1,533 words
How to Write a Cron Expression (With a Free Cron Builder)

Cron is the time-based job scheduler behind countless servers. It runs backups at night, sends reminder emails every morning, clears old files every hour, generates reports on the first of each month and publishes content on schedule. If you manage a website, a server or an application, you will write cron schedules sooner or later.

The syntax is compact but cryptic. What does */15 9-17 * * 1-5 mean? Is it every 15 minutes, or at minute 15? Does it run on weekends? A cron builder answers these questions instantly. This guide shows you how to use the free Cron Expression Builder on RexBD and explains the syntax so you can read and write schedules with confidence.

The five fields of a cron expression

A standard cron expression has five fields separated by spaces:

┌───────── minute (0–59)
│ ┌─────── hour (0–23)
│ │ ┌───── day of month (1–31)
│ │ │ ┌─── month (1–12)
│ │ │ │ ┌─ day of week (0–6, Sunday = 0)
│ │ │ │ │
* * * * *

Each field says when the job may run. The job runs whenever all the fields match the current time (with one exception for day-of-month and day-of-week, covered below).

Hours use the 24-hour clock, so 14 means 2 PM. Days of the week start with Sunday as 0. Most systems also accept 7 for Sunday, and names such as MON or JAN.

⏰ Free tool · no sign-upTry the Cron Expression BuilderBuild a cron schedule and read it in plain English. Open tool →

Special characters

Character Meaning Example Result
* Every value * * * * * Every minute
, A list 0 9,13,17 * * * At 9:00, 13:00 and 17:00
- A range 0 9-17 * * * Every hour from 9:00 to 17:00
/ A step */10 * * * * Every 10 minutes
combined Range with step 0 8-20/2 * * * Every 2 hours from 8:00 to 20:00

How to use the Cron Expression Builder

Step 1: Describe your schedule

Open the Cron Expression Builder and set when the job should run: which minutes, hours, days of the month, months and weekdays.

Step 2: Read the plain-English description

The tool translates the expression into a sentence, such as "At minute 0 past every hour from 9 through 17 on every day-of-week from Monday through Friday." This is the best check that the schedule means what you intended.

Step 3: Or paste an existing expression

If you found a cron line in a server, a script or documentation, paste it in to see what it does. This is very useful when inheriting someone else's server.

Step 4: Copy the expression

Copy the finished expression into your crontab, hosting control panel, CI/CD configuration or scheduling library.

Ad Kothay

Ready-made examples

Schedule Expression
Every minute * * * * *
Every 5 minutes */5 * * * *
Every 15 minutes */15 * * * *
Every hour, on the hour 0 * * * *
Every day at midnight 0 0 * * *
Every day at 9:30 AM 30 9 * * *
Twice a day, 8 AM and 8 PM 0 8,20 * * *
Weekdays at 6 PM 0 18 * * 1-5
Every Sunday at 3 AM 0 3 * * 0
First day of every month at 1 AM 0 1 1 * *
Every 15 minutes during office hours on weekdays */15 9-17 * * 1-5
Every 3 months on the 1st at 2 AM 0 2 1 */3 *
Once a year, 1 January at midnight 0 0 1 1 *

Many cron implementations also support shortcuts such as @hourly, @daily, @weekly, @monthly, @yearly and @reboot (run once at startup).

The day-of-month and day-of-week trap

Here is a rule that surprises many people. When both the day-of-month and day-of-week fields are restricted (neither is *), standard cron runs the job when either one matches, not both.

So 0 9 13 * 5 does not mean "Friday the 13th at 9 AM". It means "at 9 AM on the 13th of every month, and also every Friday". If you need "Friday the 13th", schedule the job for every Friday and check the date inside your script.

The builder's plain-English description makes this behaviour visible, which is one of the best reasons to use it.

Timezones: the most common real-world bug

Cron runs in the timezone of the server, or of the scheduling system, not in your local timezone. Many servers and cloud platforms use UTC.

Bangladesh Standard Time is UTC+6. If your server runs on UTC and you want a job at 9:00 AM in Dhaka, you need 0 3 * * * (3:00 UTC). Forgetting this means daily reports arrive at 3 PM instead of 9 AM, or a "midnight" cleanup runs at 6 AM local time.

How to avoid it:

  1. Check the server's timezone (on Linux, the date or timedatectl command).
  2. Convert your desired local time to the server's timezone. The Time Zone Converter does this quickly.
  3. Write a comment above the cron line stating the intended local time.
  4. If your scheduler supports a timezone setting (many modern ones do, including Laravel's scheduler and Kubernetes CronJobs), set it explicitly.

Daylight saving time adds more complexity in countries that use it. Jobs scheduled during the skipped or repeated hour may run twice or not at all. Bangladesh does not currently use daylight saving time, but servers in Europe or North America may.

A worked example: scheduling a website's daily tasks

A small news website wants three things to happen automatically:

  • Publish the next queued articles every morning at 9:00 Dhaka time.
  • Clear temporary files every hour.
  • Back up the database every night at 2:00 Dhaka time.

The server runs on UTC. Converting Dhaka times to UTC gives 3:00 for publishing and 20:00 (the previous evening in UTC) for the backup. The crontab becomes:

0 3 * * *    php /var/www/site/artisan articles:publish
0 * * * *    php /var/www/site/artisan temp:clear
0 20 * * *   /usr/local/bin/backup-db.sh

Pasting each line into the Cron Expression Builder confirms the schedules in plain English before saving.

Many modern frameworks take a different approach: a single cron line runs a scheduler every minute, and the framework decides which tasks are due. In Laravel, for example, the only crontab entry needed is:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

The individual schedules then live in the application code, with proper timezone support.

Cron on shared hosting and control panels

On shared hosting with cPanel, open the "Cron Jobs" section. You will see separate boxes for minute, hour, day, month and weekday, plus a command box. Enter the five values from your expression into the boxes, and the full command, including the path to PHP or your script, into the command field. Hosting providers often show the full path to PHP in their documentation.

Check how often your host allows jobs to run. Some shared hosts do not allow every-minute schedules.

Tips for reliable cron jobs

  1. Use absolute paths for commands and files. Cron runs with a minimal environment and may not know your usual PATH.
  2. Log the output. Redirect output to a log file (>> /var/log/myjob.log 2>&1) so you can see errors.
  3. Prevent overlapping runs. If a job can take longer than its interval, use a lock (for example flock on Linux) so two copies do not run at once.
  4. Avoid everyone running at midnight. Spreading jobs across odd minutes (such as 7 or 23 past the hour) reduces load spikes.
  5. Test the command manually first, as the same user cron will use.
  6. Monitor important jobs. Have them report success somewhere, so you notice when they silently stop.

Our cron tips and mistakes article covers monitoring and debugging in more depth.

Frequently asked questions

What does * * * * * mean?

It means "every minute of every hour of every day". It is the most frequent schedule standard cron supports.

How do I run a cron job every 30 seconds?

Standard cron cannot schedule below one minute. Either run a script every minute that does the work twice with a 30-second pause, or use a different scheduler.

Is Sunday 0 or 7?

Sunday is 0 in standard cron. Most implementations also accept 7.

Why did my job run at the wrong time?

Usually because the server uses a different timezone, often UTC. Convert your local time to the server's timezone.

Do all systems use five fields?

Standard Unix cron uses five. Some systems, such as Quartz in Java or certain cloud schedulers, add a seconds field or a year field. Check your platform's documentation.

How can I tell whether my cron job actually ran?

Log its output to a file and check the timestamps, or have the job write a line to a log or send a short notification when it finishes. On Linux, the system log (often /var/log/syslog or the journal) also records when cron starts each job. If nothing appears at the expected time, check the timezone and the command path first.

Can I schedule a job for the last day of every month?

Standard cron has no "last day" symbol. A common workaround is to run the job daily on the 28th to 31st and have the script check whether tomorrow is the 1st. Some schedulers, such as Quartz, support an L character for this.

Is the Cron Expression Builder free?

Yes. It is free and runs in your browser.

Found this useful?Share it with a friend or colleague who needs it.

Keep reading

More developer articles
321 free tools, one placeSEO, text, images, code, money, units and design. Private, fast and almost all in your browser.
Ad Kothay