Batch-rename file extensions on Mac (jpeg → jpg)

Change the extension of every matching file in a folder with one shell loop.

macOSFilesTerminalLow risk
cd into the folder and run the command below — every *.jpeg file becomes *.jpg, contents untouched.

01Command

Command
$ for f in *.jpeg; do mv "$f" "${f%.jpeg}.jpg"; done

02What it does

The loop walks every *.jpeg file in the current folder; ${f%.jpeg} strips the old suffix and .jpg is appended. Only names change — the file contents and the actual image format are untouched (a true format conversion needs sips). Swap the extensions to rename any other pair, e.g. *.txt to *.md. Preview first by replacing mv with echo mv to print what would happen without changing anything.

03Risk

RiskLow risk
RequirementsRun inside the target folder; only files directly in it are renamed.
CompatibilitymacOS 10.11 El Capitan – 15 Sequoia
!Warning: Renaming .txt to .jpg does not convert files — a wrong extension can confuse apps. Only rename between genuine synonyms.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • macOS mv command reference
    SS64 · technical · 2026-09-16
    Evidence: mv renames files; the shell ${var%pattern} expansion strips the matching suffix from the filename.

Last verified: 2026-09-16 · Category: Files & Folders

06Related solutions