What does the Cron Expression Generator do?
The Cron Expression Generator helps software engineers, DevOps practitioners, and system administrators build and validate standard 5-field Linux/Unix crontab expressions (Minutes Hours Day-of-month Month Day-of-week). It features structured schedule presets, granular field inputs, real-time syntax checking, and instant CSS/code export.
Core Concepts
Understanding Linux 5-Field Crontab Syntax:
- Field Structure:
* * * * *(Minutes, Hours, Day of Month, Month, Day of Week). - Wildcard (
*): Represents all possible values for a field (e.g. every minute, every hour). - Step Values (
/): Defines intervals (e.g.*/15in the minute field triggers every 15 minutes). - Ranges (
-): Specifies inclusive ranges (e.g.1-5in Day of Week triggers Monday through Friday). - Lists (
,): Specifies multiple discrete values (e.g.0,30in minutes triggers at minute 0 and minute 30).
How to use the tool?
- Select Preset or Edit: Pick a common schedule from the Quick Schedule Presets dropdown or edit the 5 field boxes manually.
- Real-time Evaluation: The tool validates inputs instantly and constructs the crontab string.
- Copy Output: Click
Copyon the generated crontab expression.
Related Developer Utilities
If you work with scheduling, cloud infrastructure, or DevOps workflows, explore these complementary tools:
- AWS Cron Generator: Generate 6-field AWS EventBridge/CloudWatch cron expressions.
REST API Integration
Blueutils provides a free REST API endpoint (POST https://blueutils.com/api/devops/cron-generator) to programmatically calculate and validate 5-field Linux cron expressions.
API Request Parameters
| Name | Type | Description | Example |
|---|---|---|---|
rawText |
String | (Optional) Full 5-field cron string to validate. | "*/15 * * * *" |
minutes |
String | (Optional) Minute field (0-59, *, /, -, ,). Default "0". |
"0/15" |
hours |
String | (Optional) Hour field (0-23, *, /, -, ,). Default "12". |
"*" |
dayOfMonth |
String | (Optional) Day of month field (1-31, *, /, -, ,). Default "*" |
"*" |
month |
String | (Optional) Month field (1-12, *, /, -, ,). Default "*" |
"*" |
dayOfWeek |
String | (Optional) Day of week field (0-7, *, /, -, ,). Default "*" |
"*" |
API Request Payload Examples
cURL
curl -X POST https://blueutils.com/api/devops/cron-generator \
-H "Content-Type: application/json" \
-d '{
"minutes": "*/15",
"hours": "*",
"dayOfMonth": "*",
"month": "*",
"dayOfWeek": "*"
}'Python
import requests
url = "https://blueutils.com/api/devops/cron-generator"
payload = {
"minutes": "*/15",
"hours": "*",
"dayOfMonth": "*",
"month": "*",
"dayOfWeek": "*"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String jsonPayload = """
{
"minutes": "*/15",
"hours": "*",
"dayOfMonth": "*",
"month": "*",
"dayOfWeek": "*"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://blueutils.com/api/devops/cron-generator"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}API Response Parameters
| Name | Type | Description | Example |
|---|---|---|---|
isValid |
Boolean | Indicates whether expression calculation succeeded. | true |
cronExpression |
String | Complete 5-field cron string. | "*/15 * * * *" |
rawFields |
Object | Object containing individual field strings. | { "minutes": "*/15", ... } |
API Response Payload Examples
Success Response (HTTP 200 OK)
{
"isValid": true,
"cronExpression": "*/15 * * * *",
"rawFields": {
"minutes": "*/15",
"hours": "*",
"dayOfMonth": "*",
"month": "*",
"dayOfWeek": "*"
}
}Validation Failure Response (HTTP 400 Bad Request)
{
"isValid": false,
"error": "Invalid Minute value '75': Minute must be between 0 and 59."
}Rate Limit Exceeded Response (HTTP 429 Too Many Requests)
{
"error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}Why use an API to generate Cron Expressions?
Integrating the Cron Expression API into internal developer portals, CLI utilities, or AI orchestration agents provides key benefits:
- Automated Workflow Scheduling: Validates cron expressions before writing them to crontab files or database job tables.
- AI Agent Tool Calling: Allows AI agents building automation tasks to generate valid 5-field crontab syntax programmatically.
Native Usage
How to generate crontab strings programmatically across programming environments:
Node.js (JavaScript)
function buildCron(minutes = '0', hours = '12', dom = '*', month = '*', dow = '*') {
return `${minutes} ${hours} ${dom} ${month} ${dow}`;
}
console.log(buildCron('*/15', '*', '*', '*', '*'));Linux (Bash Shell)
#!/bin/bash
MIN="*/15"; HOUR="*"; DOM="*"; MON="*"; DOW="*"
CRON="$MIN $HOUR $DOM $MON $DOW"
echo "$CRON"Python
def build_cron(min="0", hour="12", dom="*", month="*", dow="*"):
return f"{min} {hour} {dom} {month} {dow}"
print(build_cron("*/15", "*", "*", "*", "*"))Java
public class CronBuilder {
public static String buildCron(String min, String hour, String dom, String month, String dow) {
return min + " " + hour + " " + dom + " " + month + " " + dow;
}
public static void main(String[] args) {
System.out.println(buildCron("*/15", "*", "*", "*", "*"));
}
}