FreeToGenerate.com

Windows reserves 28 device names. Almost every list says 22.

The name you want to use

A hyphen by default. Anything you type here is used literally, so pick something the target system allows.

24 / 255

What had to change

  • Characters this system does not allow in a name were replaced. Windows forbids nine of them — a less-than, greater-than, colon, double quote, forward slash, backslash, pipe, question mark and asterisk — while Linux forbids only the forward slash.
  • A trailing period was removed. Windows will not accept a name that ends with one, though a leading period is perfectly fine, which is why .gitignore works.

Which systems reject the name you typed

Windows, macOS

What each system forbids

WindowsmacOSLinux
Forbidden characters< > : " / \ | ? */ :/
Reserved names28NoNo
Trailing dot or spaceYesNoNo

The Windows rules are quoted from Microsoft's Naming Files, Paths, and Namespaces; the others are the POSIX rules plus the colon macOS inherits from HFS. Nothing is uploaded — the renaming happens in this tab. (260)

The 28 reserved Windows names

CONPRNAUXNULCOM1COM2COM3COM4COM5COM6COM7COM8COM9COM¹COM²COM³LPT1LPT2LPT3LPT4LPT5LPT6LPT7LPT8LPT9LPT¹LPT²LPT³

These cannot be used as a file name on Windows, with or without an extension, in any directory. Most published lists have 22 of them.

The six marked here are the ones almost every list omits. Microsoft's documentation includes COM and LPT written with superscript digits and explains why: Windows treats those characters as digits, so they form valid device names and are reserved everywhere. The documentation even gives the test — writing to COM with a superscript one fails to create a file.

Also available in: Español · Português · Français · العربية

Filename sanitizer: illegal characters and reserved names

Paste a name, pick the system you care about, and get one that will actually save — with each change explained rather than silently applied.

What makes a filename illegal?

Less than you would expect on some systems and far more than you would expect on others, which is the whole problem. Linux forbids exactly two things inside a name: the null byte and the forward slash. Everything else is fair game — colons, question marks, trailing dots, a file called NUL. macOS adds one more, the colon, which it inherits from HFS where the colon was the path separator; that is also why the Finder swaps colons and slashes when it shows you a name.

Windows is the strict one. It forbids nine printable characters — less than, greater than, colon, double quote, forward slash, backslash, pipe, question mark and asterisk — plus the null byte and every control character from 1 to 31. It refuses names that end in a period or a space. And it reserves a set of device names that cannot be used as a filename in any directory.

So a name that works perfectly on your machine can fail on a colleague's, or inside a zip they open on Windows. This sanitizer applies whichever rules you ask for, and defaults to all of them at once.

How to use it

  1. Type or paste the name. Just the name, not the whole path — the rules that matter here apply to one component at a time.
  2. Pick which rules to apply. Safe everywhere is the default and is strictly the most aggressive; the individual systems are there when you know exactly where the file is going.
  3. Read what changed, not just the result. Every change is listed with the reason, and a panel tells you which of the three systems would have rejected the name you actually typed.

There are 28 reserved names, not 22

Nearly every list of reserved Windows filenames gives the same 22 entries: CON, PRN, AUX, NUL, COM1 through COM9, and LPT1 through LPT9. Microsoft's own documentation lists six more, and they are the ones worth knowing because nothing about them is guessable.

The extra six are COM and LPT written with superscript digits — the ¹, ² and ³ characters from ISO/IEC 8859-1. Microsoft explains the reason in a note on that page: Windows recognises those superscript characters as digits and treats them as valid parts of a COM or LPT device name, making them reserved in every directory. The documentation even supplies the test, observing that writing to COM with a superscript one fails to create a file.

The reservation also survives an extension, which trips people up more often. NUL.txt and NUL.tar.gz are both equivalent to NUL, because the rule applies to everything before the first period rather than to the stem before the last one. A tool that splits on the last dot will miss the second case entirely, and this one splits on the first.

What this tool does not do

It sanitizes one name, not a path. The 260-character limit Windows applies is a limit on the whole path, and no tool looking at a single name can know how deep it will end up; the 255 characters this page enforces are the per-name limit most file systems impose separately. Those two numbers get confused constantly and they are not the same measurement.

It also cannot tell you what your particular file system will accept. The rules here are the documented ones for Windows, for POSIX and for macOS, but a network share, a FAT-formatted USB stick or a cloud sync client can each be stricter, and some are stricter in undocumented ways. A name this page calls safe everywhere is safe against the published rules, which is the most any static tool can promise.

And it deliberately keeps a leading period. Microsoft's documentation says in as many words that a period is acceptable as the first character of a name, so .gitignore and .env are legal on Windows; only a trailing one is a problem. Stripping it, as some sanitizers do, would break dotfiles for no reason.

Why is it free?

The rules are a few hundred bytes of tables and the renaming happens in your own browser. Nothing you type is uploaded, nothing is logged, and there is no account to create.

No sign-up, no limits, and no watermark on anything you copy.