Zero Padding Rule

Files numbered 1, 10, 2 showing up in the wrong order? Use zero padding to unify digit width and get files sorting correctly.

What this feature can help you with

  • Photo numbering mess: photo1.jpg, photo10.jpg, photo2.jpg sorting wrong—want to standardize to photo01.jpg as two digits
  • Document chapter numbers: chapter1.txt, chapter99.txt with inconsistent digits—want to change to chapter001.txt three-digit format
  • Removing extra zeros: File is file0001.txt, want to simplify back to file1.txt
  • Batch file numbering: Hundreds of files with mismatched number widths—want unified format for better sorting and management

Quick start (3 steps)

  1. Click "Add Rule" button → Select "Zero Padding"
  2. Choose mode:
    • Add padding: Pad numbers with zeros (e.g., 101), set the "Padding length" (e.g., 2)
    • Remove padding: Strip extra leading zeros (e.g., 0011), no length needed
  3. Click preview first to see the result, confirm all numbers look right, then click apply

Specific examples

Example 1: Standardize photo numbers to two digits

❌ Original files: photo1.jpg, photo2.jpg, photo10.jpg 😫 Problem: System sorts them as photo1.jpg, photo10.jpg, photo2.jpg—order is completely wrong

✅ Operation:

  • Mode: Add padding
  • Padding length: 2

✅ Result: photo01.jpg, photo02.jpg, photo10.jpg

Why this setup: Standardizing to two digits makes the system sort by 01, 02, 10 correctly—order will never get mixed up again.


Example 2: Reserve four-digit numbering for large file collections

❌ Original files: img1.jpg, img99.jpg, img123.jpg 😫 Problem: Expecting thousands of photos later, current digit width is inconsistent—sorting will break when adding more

✅ Operation:

  • Mode: Add padding
  • Padding length: 4

✅ Result: img0001.jpg, img0099.jpg, img0123.jpg

Why this setup: Four digits handle 0001-9999, reserving plenty of space and keeping format consistent as you add new files later.


Example 3: Clean up extra leading zeros

❌ Original files: file0001.txt, file0023.txt, file0100.txt 😫 Problem: Those 000 at the start take up space and look messy—want to simplify back to the cleanest form

✅ Operation:

  • Mode: Remove padding

✅ Result: file1.txt, file23.txt, file100.txt

Why this setup: Stripping leading zeros restores the natural form of numbers, making filenames more concise.

What you need to fill in

Basic settings

  • Mode (pick one)
    • Add padding: Add zeros before numbers, e.g., 1 becomes 01 or 001
    • Remove padding: Strip extra leading zeros, e.g., 001 becomes 1

Settings specific to Add padding mode

Only needed if you choose "Add padding":

  • Padding length How many digits you want total, e.g., 2 means two digits (01, 10), 3 means three digits (001, 100) (default 2, minimum 1, cannot be empty)

Advanced options (don't worry if you skip these, defaults work fine)

  • Ignore extension Enabled by default—only changes the filename, leaves .jpg, .txt and other extensions alone. If your extension contains numbers (like .mp3), it could be affected; you can check this option to avoid changing extensions.

Common questions

❓ Only some numbers got processed?

This rule processes all numbers in the filename, including years, version numbers, chapter numbers, etc.

Example: report_2024_v1_draft5.docx with padding length 3

  • Result: report_2024_v001_draft005.docx (all numbers become three digits)

If you only want to change numbers in a specific position, try the Regex rule for precise control.

❓ What if padding length is smaller than existing digits?

It won't truncate—numbers already at or exceeding the target length stay unchanged.

Example: With padding length 2

  • file1.txtfile01.txt (less than two, gets padded)
  • file100.txtfile100.txt (already three, stays the same)

❓ Sorting gets scrambled after removing padding?

That's normal. After stripping leading zeros, the system sorts alphabetically instead of numerically.

Example: Before removing: 01, 02, 10; after: 1, 10, 2 (alphabetical order)

Solution: If you need correct sorting again, switch back to "Add padding" mode to re-standardize the width.

❓ My year in the filename also changed?

Yes, the rule processes all numbers, including years.

Example: travel_photos_2024_001.jpg with padding length 3

  • Result: travel_photos_2024_001.jpg (2024 is already four digits, stays same; 001 is already three, stays same)
  • If padding length set to 5: travel_photos_02024_00001.jpg (all numbers become five digits)

Check the preview carefully to make sure years are what you expect.

Important notes:

  • ⚠️ All numbers get processed: Years, versions, chapters, everything—always check preview first
  • ⚠️ Removing padding affects sorting: Stripping leading zeros changes file order; re-apply padding if needed
  • ⚠️ Test before bulk applying: Try a few files first, confirm results look good before selecting all

Advanced techniques

  • Combine with "Sequence": Use sequence rule first to add uniform numbering (like 1, 2, 3...), then zero padding to standardize digit width (like 001, 002, 003...)
  • Combine with "Find and Replace": Clean up special patterns first (like remove copy, backup), then use zero padding to standardize number format
  • Combine with "Insert Text": After padding, insert separators before/after numbers (like _) for clearer structure (e.g., photo_001_edited.jpg)

What to look at next?

  • Sequence: Batch add ordered numbers to files, combine with zero padding to ensure consistent format
  • Find and Replace: Clean and standardize filename format, preparing for zero padding
  • Insert Text: Add separators or markers to make the number portion stand out more