How to batch rename files safely, with a preview and no uploads

Two hundred photos called IMG_4821.JPG, a download folder full of names with spaces, or a set of scans that must be numbered 001, 002, 003. Renaming them by hand is slow, and a careless bulk rename can overwrite files you wanted.

Why preview first

A rename is one of the few operations that can destroy data without a warning: if two files end up with the same name, one silently replaces the other on many systems. A before/after table makes the result visible before anything happens, and lets you adjust the rules until every row reads the way you want.

The rules that cover most jobs

GoalRuleExample
Remove a camera prefixFind IMG_, replace with nothingIMG_4821.JPG → 4821.JPG
Tidy a downloads folderSpaces → -, lowercase, remove forbidden charactersReport: Q3 Final?.PDF → report-q3-final.pdf (with extension lowercased)
Number a set of scansNumbering → replace name, start 1, 3 digits, add prefix scan-scan-001.png, scan-002.png …
Fix the orderSort names naturally before numberingpage2 before page10
Swap two partsRegular expression ^(\w+)_(\w+)$ → $2_$1smith_john → john_smith

Why the page only wants names

A web page cannot rename files on your disk, and it does not need their contents to work out new names. The tool therefore reads only the name text of each file you pick (or lines you paste). Nothing is read from inside the files, nothing is sent anywhere, and it keeps working if you go offline after the page has loaded. The output is a script: you read it, then you run it.

Running the script

  1. Open the folder in a terminal. macOS and Linux: cd into the folder. Windows: in File Explorer choose Open in Terminal, or use PowerShell and cd to it.
  2. Paste the script. bash uses mv -n -- 'old' 'new': -n refuses to overwrite, -- protects names that start with a dash, and single quotes protect spaces and symbols. PowerShell uses Rename-Item -LiteralPath so brackets and wildcards in names are treated as plain text.
  3. Keep the undo. The tool can also copy a reverse script. Save it before you run the first one.
mv -n -- 'IMG 0044 (copy).jpg' 'img-0044-copy.jpg'

What it will not do

It cannot see other files in the folder that you did not load. If a new name might match a file that is not in your list, the safe mv -n and Rename-Item commands stop instead of overwriting it. It also cannot read dates or camera data from inside photos; if you need names like 2026-11-08_001.jpg, add the date as a prefix and number the rest. Renaming does not remove location data hidden inside photos: use the image compressor to make private copies without GPS tags.

Related

Get photos off your phone over USB · Back up phone photos to an external drive · Number files in the order you choose (drag to reorder) · Turn sideways photos the right way up and number them like chapters · Why a batch rename overwrites or skips files (name collisions) · Why file10 sorts before file2 (leading zeros) · Case-only renames on Windows, macOS and Git · Windows reserved names: CON, NUL, AUX · Remove spaces and symbols from file names · Batch rename tool (names only, in your browser) · Compress many photos at once · Invisible characters in text

Questions

Are my files uploaded when I use the batch rename tool?

No. The tool only reads the names of the files you choose or the text you paste. It never opens the files, and nothing is sent to a server.

Can a web page rename the files on my computer?

Not directly. Browsers do not let pages rename files in your folders, so the tool gives you a bash or PowerShell script that you run yourself after checking the preview.

How do I rename many files in Windows or macOS without installing anything?

Paste the generated script into PowerShell (Windows) or Terminal (macOS and Linux) in the folder that holds the files. Both tools are already installed.

How do I add 001, 002, 003 to file names?

Choose a numbering mode, set the start number and the number of digits (3 gives 001), and sort names naturally first if the order matters.

Will it overwrite a file that already has the new name?

The preview blocks it when the clash is inside your list, and the generated commands use mv -n or Rename-Item, which refuse to overwrite existing files.

Published · updated .

Try it

Related guides

Newest guides