5-Field vs 6-Field Cron: What Changes?

October 28, 2026 · 4 min read · By Michael Lip

Short answer. A five-field cron expression sets minute, hour, day of month, month and day of week. A six-field expression adds seconds in front, so each later field moves one position right. Paste a five-field line into a six-field scheduler unchanged and the job runs at the wrong time, or the scheduler rejects the line.

Updated 2026-10-28

Both formats describe the same idea: match the current time against a set of fields, and run the command when every field matches. The difference is where the matching starts. Field count is the first thing to check when a schedule looks shifted by a few hours or refuses to save.

The five standard fields

The POSIX crontab format is the reference. The manual page on this machine lists exactly five time fields and their allowed values:

FieldAllowed values, as printed by man 5 crontab
Minute0 to 59
Hour0 to 23
Day of month1 to 31
Month1 to 12, or the first three letters of the name
Day of week0-7 (0 or 7 is Sun, or use names)

The same page defines the operators: an asterisk stands for first to last, a hyphen gives an inclusive range such as 8-11, a comma gives a list such as 0-4,8-12, and a slash gives a step, so */2 in the hour field means every second hour. Month and day of week accept the first three letters of the name.

Where the sixth field goes

Schedulers that support seconds put the seconds field first, not last. Spring's @Scheduled cron support, Quartz, and AWS EventBridge all document a six-field expression that starts with seconds, which shifts every other field one position to the right:

PositionFive fieldsSix fields
1minutesecond
2hourminute
3day of monthhour
4monthday of month
5day of weekmonth
6-day of week

Two readings of almost the same line

Take the schedule "every day at 02:30". The five-field form is:

30 2 * * *      minute 30, hour 2, every day

In a six-field scheduler the same intent needs a seconds value in front, or the fields are read one place to the left and the line means "every minute of hours 30 and 2":

0 30 2 * * *    second 0, minute 30, hour 2, every day

That misreading is the usual reason a migrated schedule runs 24 times an hour at two in the morning instead of once. Check the field count before you check anything else.

Rules that do not change

Checklist before you paste a cron line

  1. Count the fields. Five means minute first, six means second first.
  2. Read the line aloud field by field and confirm the rightmost field before the command is day of week.
  3. Confirm Sunday is 0 in your scheduler, or write Sunday as a name.
  4. Confirm the month numbering is 1 to 12, or convert it.
  5. Run the expression through a builder that prints the next fire times, and compare them with the wall clock you expect.

InvokeBot's cron expression builder prints the next run times for an expression, and the cron to webhook scheduler turns the same schedule into a webhook trigger. On macOS, note that man 5 crontab records that cron has been absorbed into launchd, so a plist schedule on that platform has its own key names rather than cron fields.

Frequently Asked Questions

Does a six-field expression always start with seconds?

Check the documentation of the scheduler you are using rather than assuming. Seconds-first is the common convention for systems that add a sixth field, but a scheduler that extends the format at the end instead would place the extra field differently. If the documentation does not say, test one line and read the next fire times.

Why does "0 0 * * 0" run on Sunday?

Because the day of week field accepts 0 for Sunday in the POSIX format, and the manual page lists 0 or 7 as two ways to write the same day. The first two zeros in that line are minute and hour, midnight, and the final zero is day of week.

What happens if I drop the seconds field from a six-field line?

The remaining five fields are read as minute, hour, day of month, month and day of week. A line built for a seconds-first scheduler loses its last field and the day of week value becomes the month value, which usually produces a validation error or a schedule that fires on the wrong days. Convert the line instead of truncating it.

Frequently Asked Questions

How do I verify a webhook signature with HMAC-SHA256?

Compute HMAC-SHA256 of the raw request body using your webhook secret, then compare the hex digest to the signature header. In Node.js: const sig = crypto.createHmac('sha256', secret).update(rawBody).digest('hex'). Use crypto.timingSafeEqual() for comparison to prevent timing attacks. Always hash the raw bytes, never parsed JSON.

What are the most common webhook security vulnerabilities?

The top vulnerabilities are: missing signature verification (accepting any request), using parsed JSON instead of raw body for HMAC (breaks signatures), string comparison instead of constant-time comparison (enables timing attacks), no timestamp validation (allows replay attacks), missing TLS (payloads visible in transit), and overly permissive IP allowlists.

Should I restrict webhook endpoints by IP address?

IP allowlisting is a defense-in-depth measure but should not be your only protection. Major providers publish their webhook source IPs. IP allowlisting blocks spoofed requests before they reach your application code, but HMAC signature verification is still required because IPs can be spoofed at the network level.

How do I prevent webhook replay attacks?

Include a timestamp in the signed payload and reject requests older than 5 minutes. Store processed event IDs and reject duplicates. Together, timestamp validation and idempotency keys prevent both replay attacks and duplicate processing from legitimate retries.

What should my webhook endpoint return on failure?

Return 200 for successfully processed events, 202 for accepted-but-queued events, 400 for malformed payloads, 401 for invalid signatures, and 500 for internal processing errors. Never return detailed error messages — they leak implementation details to attackers. The status code alone tells the provider whether to retry.

Related Tools

By the same builder: GitHub — theluckystrike BeLikeNative — Grammar AI EarlyThunder — Dev Blog Bug Bounty Reality Zovo — AI Dev Tools