100% free · No signup · No watermark · Runs entirely in your browser
A filename sanitizer cleans file names that break uploads, downloads and sync tools. Paste any messy name - with illegal characters like / : * ? or stray spaces - and this free tool rewrites it into a safe, portable filename that works on Windows, macOS and Linux. Your extension is preserved, and everything runs in your browser, so file names never leave your device.
Clean your filename
Paste any messy file name. The safe version appears instantly, with the extension preserved.
Frequently asked questions
Which characters are illegal in filenames?
On Windows, nine characters are forbidden: < > : " / \ | ? * plus any control character. macOS and Linux forbid / and the null character. This tool removes or replaces all of them so the result works across every operating system.
Is this filename sanitizer really free?
Yes. Unlimited sanitizing, no signup, no watermark, no daily caps. Everything runs locally in your browser with plain JavaScript.
Will it keep my file extension?
Yes. The tool splits the name at the last dot, sanitizes only the base name and reattaches the extension untouched, so a file ending in .PDF keeps working exactly as before.
Spaces or hyphens: which is better for filenames?
Hyphens or underscores are safest: spaces break in URLs, command lines and some upload forms. Use hyphens for web-facing files and SEO, underscores when a system treats hyphens specially, such as some programming tools.
Do you upload or store my filenames?
No. Sanitizing happens entirely in your browser. Nothing is sent to a server, stored or logged, so even sensitive file names stay private.
How do I remove illegal characters from a filename?
Short answer: Paste the name into the tool above, choose whether illegal characters are removed or replaced with an underscore or hyphen, and copy the clean result. The tool targets the Windows-forbidden set (< > : " / \ | ? *) plus control characters, accents and stray spaces, and it preserves your file extension automatically.
This matters because a single forbidden character can make an upload fail, break a download link or stop a cloud sync. Cleaning names before you share files saves you from cryptic errors later.
What makes a filename safe for Windows and Mac?
Short answer: A safe filename avoids the Windows-forbidden characters, stays under about 100 characters, uses hyphens or underscores instead of spaces, and keeps a simple lowercase extension. Because Windows has the strictest rules, a name that is valid on Windows is valid almost everywhere.
The sanitizer applies all of these rules in one pass, so you do not need to memorize which characters each operating system forbids.
Should filenames be lowercase with hyphens?
Short answer: For anything web-facing, yes: lowercase hyphenated names are URL-safe, easy to type and preferred by search engines. For internal documents the choice matters less, but consistency still helps sorting and searching. Enable the lowercase and hyphen options above to get web-ready names by default.
One exception: some camera and design workflows expect exact original names, so keep the lowercase option off when renaming must be minimal.