Every operating system and filesystem uses a reserved set of characters to manage files and folders, so certain symbols cannot appear in a filename. Using these restricted characters usually causes errors when you create, save, upload, or share content.
Understanding these limits helps you avoid broken links, failed uploads, and confusing system errors. The table below summarizes which characters are banned across common platforms and why these restrictions exist.
| Platform | Forbidden Characters | Primary Reason for Restriction | Practical Impact |
|---|---|---|---|
| Windows | < > : " / \ | ? * | Reserved for paths, drive letters, and special devices | System commands and file paths break if these appear |
| macOS (APFS/HFS+) | : / | Colon is a legacy path separator; slash is the root | Files cannot be named with these even on APFS volumes |
| Linux/Unix | / null byte | Slash separates directories; null terminates strings | Commands and scripts fail if slashes appear in names |
| Web/URLs | " < > # % { } \ ^ ~ [ ] ` | Reserved for encoding, protocol structure, or security | Uploads and URLs may break or be encoded unexpectedly |
| General across platforms | Control characters (0x00–0x1F, 127) | Non-printable characters break tools and APIs | Files with these characters are hard to manage or delete |
Reserved Characters in Windows File Names
On Windows, the characters < > : " / \ | ? * are completely blocked in filenames and reserved for system functions. The backslash and slash act as path separators, while quotes and colons serve protocol roles used by command-line tools.
Attempting to create a file with any of these symbols typically results in an immediate error, and some programs silently replace or strip them, leading to unexpected filename changes when moving files between systems.
Restricted Characters on macOS and Linux
macOS Specifics
macOS allows most printable characters but reserves the colon (:) for internal use and does not permit the forward slash (/) because it marks path boundaries in the filesystem. This means names with slashes or colons cannot be created through Finder or command line.
Linux and Unix Rules
Linux and Unix treat the forward slash (/) as the directory separator and the null byte as an invisible limit for string handling. Filenames cannot include slashes or the null character, and names must avoid control characters to remain manageable in scripts and terminals.
Reserved Characters in URLs and Web Uploads
When filenames travel over the web, additional symbols become problematic because they have special meanings in URLs and HTML. Quotes, angle brackets, percent signs, braces, carets, tildes, and square brackets can disrupt parsing, encoding, or security checks, so they are either stripped or encoded during upload.
Spaces are technically allowed but often converted to %20 or plus signs, so using hyphens or underscores improves reliability and readability in web contexts.
Best Practices for Naming Files Safely
- Use letters, numbers, hyphens, and underscores to maximize compatibility.
- Avoid symbols like \ / : * ? " < > | on any major platform.
- Replace spaces with hyphens or underscores for web-friendly names.
- Steer clear of control characters and non-ASCII symbols when sharing files across systems.
- Test filenames in the target environment before mass uploading or publishing.
FAQ
Reader questions
Why does Windows block characters like in filenames?
These symbols are reserved for redirection and console commands, so including them in filenames would break command-line operations and system calls.
Can I upload a file with a colon in the name to a website?
Most web platforms will reject or encode colons because they conflict with URL structure and protocol rules, which can lead to broken links or failed uploads.
What happens if a filename contains a slash on Linux?
Since the slash separates directories, a filename with a slash is impossible to interpret, and the system will return an error when you try to create or access it.
Are spaces allowed in filenames across all platforms?
Yes, spaces are generally allowed, but they can cause issues in scripts and URLs, so replacing them with hyphens or underscores is a best practice for portability.