Folge.me logo
Folge Tools
How do you like this tool?
Got Feedback? 📢

Folge.meCreate step-by-step guides and documentation with Folge. One-Time Price, Private, Offline. Best alternative to ScribeHow, Tango.us.

Download Now

Cron Expression Explainer

Decode and visualize cron expressions. Get human-readable explanations and see when your scheduled tasks will run.

Cron Expression Explainer

Format: minutes hours dayOfMonth month dayOfWeek

Human-Readable Description

Runs every minute

Field Breakdown

FieldValueDescription
minute*Minute (0-59)
hour*Hour (0-23)
dayOfMonth*Day of Month (1-31)
month*Month (1-12)
dayOfWeek*Day of Week (0-6)
* * * * *

Every minute

0 * * * *

Every hour

0 0 * * *

Every day at midnight

0 0 * * 0

Every Sunday at midnight

0 0 1 * *

First day of every month at midnight

0 0 1 1 *

January 1st at midnight (yearly)

0 9-17 * * 1-5

Every hour from 9 AM to 5 PM, Monday to Friday

*/15 * * * *

Every 15 minutes

0 0 */2 * *

Every other day at midnight

CharacterDescriptionExample
*Any value

* * * * * - Every minute of every hour of every day

,Value list separator

1,15 * * * * - At minutes 1 and 15 of every hour

-Range of values

1-5 * * * * - At minutes 1 through 5 of every hour

/Step values

*/15 * * * * - Every 15 minutes

?No specific value (used instead of * for day-of-month or day-of-week)

0 0 ? * 1 - At midnight on Mondays

LLast day of month or week

0 0 L * * - At midnight on the last day of the month

WNearest weekday

0 0 15W * * - At midnight on the nearest weekday to the 15th of the month

#Nth day of month

0 0 * * 1#3 - At midnight on the third Monday of every month

One time price

About Cron Expressions

Cron expressions are a concise and powerful way to define recurring schedules for automated tasks. Originally developed for the Unix cron daemon, these expressions are now widely used in various scheduling systems, job runners, and programming frameworks across different platforms.

A standard cron expression consists of five fields separated by spaces, representing:

  • Minute (0-59)
  • Hour (0-23)
  • Day of Month (1-31)
  • Month (1-12 or JAN-DEC)
  • Day of Week (0-6 or SUN-SAT, where 0 is Sunday)

Some systems, like the Quartz Scheduler, use an extended format with six fields, adding seconds at the beginning for more precise scheduling.

How to Use the Cron Expression Explainer

  1. Enter your cron expression in the input field (e.g., "0 0 * * *" for daily at midnight)
  2. Toggle the Quartz format switch if you're using the 6-field format with seconds
  3. Click "Parse Expression" to analyze your cron syntax
  4. View the human-readable explanation to understand what your expression means
  5. Check the field breakdown to see how each part of your expression is interpreted
  6. See the next execution dates to verify your schedule works as expected
  7. Use the common expressions section for quick reference to frequently used schedules

Common Cron Expression Examples

ExpressionDescription
* * * * *Every minute
0 * * * *Every hour, on the hour
0 0 * * *Daily at midnight
0 0 * * 0Weekly at midnight on Sunday
0 0 1 * *Monthly at midnight on the 1st day
0 0 1 1 *Yearly at midnight on January 1st
*/15 * * * *Every 15 minutes
0 9-17 * * 1-5Every hour from 9 AM to 5 PM, Monday to Friday

Special Characters in Cron Expressions

Cron expressions use special characters to represent different scheduling patterns:

  • * (Asterisk): Represents "all possible values" for the field
  • , (Comma): Used to specify multiple values (e.g., "MON,WED,FRI")
  • - (Hyphen): Defines a range of values (e.g., "1-5" for Monday through Friday)
  • / (Slash): Specifies increments (e.g., "*/15" for every 15 minutes)
  • ? (Question mark): Represents "no specific value" (used in some systems)
  • L (Last): Represents the last day of the month or week
  • W (Weekday): Specifies the nearest weekday to a given day of the month
  • # (Hash): Specifies the nth day of the week in a month (e.g., "6#3" for the third Saturday)

Where Are Cron Expressions Used?

Cron expressions are widely used in various systems and tools:

  • Unix/Linux Cron Jobs: The original use case for scheduling system tasks
  • CI/CD Pipelines: For scheduling automated builds and deployments
  • Job Schedulers: Like Quartz, Spring Scheduler, and Hangfire
  • Cloud Services: AWS EventBridge, Azure Functions, Google Cloud Scheduler
  • Monitoring Systems: For scheduling regular checks and alerts
  • Database Maintenance: For scheduling backups, cleanups, and optimizations
  • Web Applications: For scheduling recurring tasks like report generation

FAQs

What is a cron expression?

A cron expression is a string consisting of five or six fields separated by white space that represents a schedule for recurring tasks in Unix-like operating systems. The fields specify when the task should run in terms of minutes, hours, days of the month, months, and days of the week. Cron expressions are widely used in job schedulers, task automation tools, and many programming frameworks.

What is the format of a cron expression?

The standard cron format consists of five fields: minute, hour, day of month, month, and day of week. Each field can contain specific values, ranges, lists, or special characters. For example, "0 0 * * *" represents midnight every day. Some systems (like Quartz Scheduler) use a six-field format that includes seconds as the first field.

What do the special characters in cron expressions mean?

Cron expressions use several special characters: * (asterisk) means "any value" or "every"; , (comma) separates multiple values; - (hyphen) defines ranges; / (slash) specifies increments; ? (question mark) means "no specific value" (used in some systems); L means "last day"; W means "weekday"; and # specifies the nth occurrence of a weekday in a month.

What's the difference between the standard cron format and Quartz format?

The standard cron format used in Unix/Linux systems has five fields (minute, hour, day of month, month, day of week). The Quartz format, used in the Quartz Scheduler, adds a sixth field at the beginning for seconds, making it more precise for scheduling tasks that need second-level granularity.

How do I specify "every 15 minutes" in a cron expression?

To run a task every 15 minutes, you would use the cron expression "*/15 * * * *". The */15 in the minutes field means "every 15 minutes starting from minute 0".

Can I use day of month and day of week together in a cron expression?

In standard cron, when both day of month and day of week are specified (not *), the condition is treated as an OR operation - the task runs when either condition is met. In some implementations like Quartz, you can use ? in one of these fields to indicate "no specific value" when you want to specify only one of them.

How do I schedule a task to run on weekdays only?

To run a task on weekdays only (Monday through Friday), you would use "0 0 * * 1-5" to run it at midnight. The 1-5 in the day of week field represents Monday through Friday (in standard cron, Sunday is 0 and Saturday is 6).

Does this tool account for daylight saving time changes?

This tool calculates execution times based on your local time zone, including daylight saving time adjustments. However, be aware that cron jobs in actual systems might behave differently during DST transitions depending on the specific system implementation.