You try to rename a file in OneDrive and get an error message. The file name contains characters like a question mark, asterisk, or colon. OneDrive and Windows both restrict certain special characters in file names to prevent conflicts with the operating system and cloud sync.
This article explains exactly which characters are blocked, why they are blocked, and how to rename your file so it syncs correctly. You will learn the list of forbidden characters, the error messages you might see, and the correct naming rules for OneDrive.
You will also find steps to rename files that contain special characters, including how to use the command line to remove them in bulk.
Key Takeaways: OneDrive File Name Special Character Restrictions
- Windows file name rules: OneDrive inherits the Windows restriction on nine special characters: \ / : ? ” < > |
- OneDrive-specific blocked characters: The tilde ~ and the number sign # are also blocked in OneDrive file names to avoid URL encoding conflicts.
- Error message behavior: OneDrive shows “The file name you specified is not valid” or “The parameter is incorrect” when a forbidden character is present.
Why OneDrive Blocks Special Characters in File Names
OneDrive uses the Windows file system to store files locally on your PC. Windows has a set of reserved characters that cannot be used in file or folder names. These characters have special meanings in the operating system. For example, the backslash separates folders in a path, and the colon follows a drive letter.
When you add a file to OneDrive, the file name must comply with both Windows naming rules and OneDrive’s own sync rules. OneDrive blocks additional characters that Windows might allow in certain contexts because those characters cause problems during cloud sync, web access, or URL generation.
The Complete List of Forbidden Characters
The following characters cannot appear anywhere in a OneDrive file or folder name:
- Backslash \
- Forward slash /
- Colon :
- Asterisk
- Question mark ?
- Quotation mark “
- Less than sign <
- Greater than sign >
- Vertical bar |
- Tilde ~
- Number sign #
Windows blocks the first nine characters. OneDrive adds the tilde and number sign to the list. The tilde is used in short file names on older systems. The number sign is used in URLs to indicate a fragment identifier. OneDrive web URLs treat the # character as a bookmark anchor, which breaks file access.
Error Messages You Will See
When you try to rename a file with a forbidden character in File Explorer, Windows shows a dialog: “You can’t use the following characters: \ / : ? ” < > |” If you use the OneDrive website to rename a file, OneDrive shows “The file name you specified is not valid” or “The file name contains invalid characters.”
If a file gets synced from another device with a forbidden character in its name, OneDrive creates a conflict copy or fails to sync the file. The sync icon in the system tray shows a red X or a paused state.
Steps to Rename a File That Contains Special Characters
Follow these steps to rename a file that currently has a forbidden character in its name. You can use File Explorer, the OneDrive website, or the command line.
- Locate the file in File Explorer
Open File Explorer and navigate to your OneDrive folder. The default location is C:\Users\YourName\OneDrive. Find the file with the special character in its name. - Right-click the file and choose Rename
Click the file once, then press F2 on your keyboard. Or right-click the file and select Rename from the context menu. The file name becomes editable. - Remove or replace the special character
Delete the forbidden character and type a valid replacement. Use a space, hyphen, underscore, or period instead. For example, replace “file:name.txt” with “file-name.txt” or “file_name.txt”. - Press Enter to confirm
Press the Enter key. Windows checks the new name. If it contains no forbidden characters, the rename succeeds. OneDrive syncs the change to the cloud. - Verify the file on the OneDrive website
Open a web browser, go to onedrive.live.com, and sign in. Navigate to the folder where the file is stored. Confirm the file name appears correctly without the special character.
Use the OneDrive Website to Rename Files
- Sign in to onedrive.live.com
Open your browser and go to onedrive.live.com. Sign in with your Microsoft 365 work or school account. - Select the file
Click the file to select it. A check mark appears on the file icon. - Click Rename in the toolbar
At the top of the page, click the Rename button. It looks like a pencil icon next to the file name. The file name becomes editable. - Type a valid file name
Delete the special character. Type a new name using only letters, numbers, spaces, hyphens, underscores, and periods. Click Save.
Rename Multiple Files With Special Characters Using Command Prompt
- Open Command Prompt as administrator
Press the Windows key, type cmd, right-click Command Prompt, and select Run as administrator. Click Yes in the User Account Control dialog. - Navigate to the OneDrive folder
Type cd C:\Users\YourName\OneDrive and press Enter. Replace YourName with your actual Windows username. - Use the ren command to rename the file
Type ren “oldfile:name.txt” “newfile-name.txt” and press Enter. The old file name must be in quotes if it contains a special character. Replace oldfile:name.txt with your actual file name and newfile-name.txt with the valid name. - Repeat for each file
Run the ren command for each file that needs renaming. Check OneDrive to confirm the files sync correctly.
If OneDrive Still Shows a Rename Error
OneDrive says “The parameter is incorrect”
This error appears when the file name contains a character that Windows allows but OneDrive blocks, such as the tilde ~ or number sign #. Rename the file using the OneDrive website instead of File Explorer. The website applies OneDrive’s stricter rules and will show a clearer error message. Remove the tilde or number sign from the name.
File name appears correct but OneDrive still fails to sync
Check for trailing spaces or periods at the end of the file name. Windows removes trailing periods in some views, but they still exist in the file system. OneDrive blocks file names that end with a period or space. Rename the file and delete any trailing period or space. Use the command line to see the exact file name: type dir /x and look for unexpected characters.
File was synced from another device and cannot be renamed
If a file with a forbidden character was synced from a Mac or a Linux system, OneDrive may create a conflict copy named “File name (1).extension” or mark the file as unsyncable. Delete the conflict copy on the OneDrive website. Then rename the original file on the device where it was created. Remove the special character and let OneDrive sync the corrected name.
Comparison: OneDrive vs Windows vs SharePoint File Name Rules
| Item | OneDrive | Windows (NTFS) | SharePoint Online |
|---|---|---|---|
| Maximum name length | 255 characters | 255 characters | 255 characters |
| Forbidden characters | \ / : ? ” < > | ~ # | \ / : ? ” < > | | \ / : ? ” < > | ~ # % & { } |
| Trailing period allowed | No | Yes, but hidden | No |
| Trailing space allowed | No | Yes, but hidden | No |
| Case sensitivity | Case-preserving, case-insensitive | Case-preserving, case-insensitive | Case-preserving, case-insensitive |
OneDrive and SharePoint have stricter rules than Windows alone. If you plan to move files between OneDrive and SharePoint, use the SharePoint rule set as your baseline to avoid future errors.
You now know the exact list of characters OneDrive blocks and the reasons behind each restriction. To rename a file, use File Explorer or the OneDrive website and replace the forbidden character with a hyphen or underscore. For bulk renaming, the Command Prompt ren command works reliably.
Next time you create a file, avoid using the tilde ~ or number sign # in the name. These characters cause problems on the OneDrive website and in shared links. If you manage files for a team, set a naming convention that uses only letters, numbers, hyphens, and underscores.
A practical tip: use the PowerShell command Get-ChildItem -Recurse | Where-Object {$_.Name -match ‘[\\/:\?”<>|~#]’} to find all files in your OneDrive folder that contain forbidden characters. Run this command from a PowerShell window to audit your entire sync folder in seconds.