Filename Sanitizer
Turn any text into a safe file name. Strips forbidden characters, folds accents, renames Windows reserved names and caps the length in UTF-8 bytes.
Safe file names
Enter one or more file names above. Characters that break Windows, macOS or Linux are removed, accents are folded, reserved device names are renamed and the result is capped to a safe byte length.
What is the Filename Sanitizer?
File names break in predictable ways. Windows forbids a handful of punctuation characters outright, refuses names like CON and LPT1 no matter what extension you add, and silently drops trailing dots and spaces.
- Removes the punctuation Windows forbids plus all C0 and C1 control characters
- Folds accents to ASCII using NFD decomposition and mark removal
- Renames CON, PRN, AUX, NUL, COM1-9 and LPT1-9 so Windows accepts them
- Truncates to a UTF-8 byte cap without splitting a character or losing the extension
- Processes hundreds of names at once, one per line
- Per-name table explaining exactly what was changed and why
How to use the Filename Sanitizer
- 1
Paste your file names into the box, one per line.
- 2
Choose whether spaces become hyphens or underscores, stay as spaces, or are removed.
- 3
Set the maximum length in UTF-8 bytes — 255 matches most filesystems.
- 4
Tick whether to lowercase everything and whether to fold accents to ASCII.
- 5
Copy or download the cleaned list, and check the “What changed” table for the reason behind each edit.
About the Filename Sanitizer
File names break in predictable ways. Windows forbids a handful of punctuation characters outright, refuses names like CON and LPT1 no matter what extension you add, and silently drops trailing dots and spaces. Accented characters and emoji survive on modern systems but wreck URLs, shell scripts and older archives, and most filesystems cap a name at 255 bytes rather than 255 characters.
This sanitizer handles all of it in one pass. It removes forbidden and control characters, folds accents to ASCII via NFD decomposition, collapses whitespace to the separator you choose, renames Windows reserved device names, trims trailing dots and spaces, and truncates to a UTF-8 byte cap while keeping the extension intact.
Paste one name or hundreds, one per line, and a table shows exactly what changed and why for each one. Everything runs locally in your browser, so file lists from private projects are never uploaded.
Frequently asked questions
Which characters are not allowed in a file name?
Windows forbids the angle brackets, colon, double quote, forward slash, backslash, pipe, question mark and asterisk, along with every control character. macOS and Linux are far more permissive, but a name that works everywhere should avoid all of them, which is what this tool does.
Why can I not name a file CON or PRN?
They are reserved MS-DOS device names, and Windows still refuses them even with an extension, so CON.log is invalid too. The tool appends _file to any reserved stem so the name becomes usable.
Why is the limit in bytes rather than characters?
Because most filesystems count bytes. A name of 255 accented or CJK characters can be 500 or more bytes in UTF-8 and will be rejected. The tool measures real UTF-8 bytes and cuts on a character boundary so nothing is left half-encoded.
Will the file extension be preserved?
Yes. The extension is separated before any cleaning, then re-attached after truncation, so shortening a long name never eats the .pdf or .jpg on the end.
Are my file names uploaded?
No. Everything is processed in your browser with JavaScript, so your file lists stay on your device and the tool works with no network connection.
Related tools
Slug Generator
A free online slug maker that turns any title into a clean, SEO-friendly URL slug: lowercase, accents removed, words joined by hyphens. Live preview and copy.
Line Ending Converter (CRLF, LF, CR)
Detect and convert CRLF, LF and CR line endings. Counts each style, flags mixed files and rewrites the whole document to the one you choose.
Remove Extra Spaces
Collapse double spaces into one, trim spaces at line ends and convert tabs to spaces. Clean messy whitespace from pasted text instantly.
Case Converter
Convert text between uppercase, lowercase, Title Case, Sentence case, camelCase, snake_case, kebab-case and more. Free online case converter.
Homoglyph Detector
Spot Cyrillic, Greek and other characters disguised as ASCII letters in domains, brand names and messages. Shows the position, script and code point of each one.