sodcalculator

10 Tech How-To

Fix Computer Name Invalid Error Windows 10

Guide 10-35076 · Updated · Step by step

If you see a “computer name is invalid” error when renaming your PC in Windows 10, the fix is usually to check for illegal characters, shorten the name, or clear the DNS cache. This guide walks you through the exact steps to resolve the error and rename your computer successfully.

What Causes the Invalid Computer Name Error

Windows 10 enforces strict naming rules for computer names because they are used on the network. The error appears when the name you enter violates one of these rules. Common causes include:

  • Using characters that are not allowed, such as spaces, underscores, or special symbols like ! @ # $ % ^ & *
  • Making the name longer than 15 characters
  • Using a name that is already in use on the network
  • Having a corrupted DNS cache or stale network settings
  • Entering a name that is entirely numeric (e.g., “12345”)

The error message may appear in the Settings app, the System Properties dialog, or when using the rename-computer PowerShell command. The fix is the same regardless of where you try to rename.

Allowed Characters and Naming Rules

Windows 10 computer names can only contain letters (a-z, A-Z), numbers (0-9), and hyphens (-). The name must not be entirely numeric, and it cannot contain spaces or any special characters. The maximum length is 15 characters. Additionally, the name must not be the same as the workgroup name (usually WORKGROUP) or the same as another computer on the same network.

If you are using a Microsoft account, the computer name is separate from your account name. You can change it without affecting your account.

How to Fix the Error: Step-by-Step

  1. Check the name you entered. Make sure it follows the rules above. Remove any spaces, underscores, or special characters. Use a hyphen if you need a separator, e.g., DESKTOP-ABC.
  2. Shorten the name. If your name is longer than 15 characters, trim it. For example, MY-LAPTOP-2025 is 15 characters (count the hyphens) – that works, but MY-LAPTOP-2025-PRO is too long.
  3. Clear the DNS cache. Open Command Prompt as administrator and type ipconfig /flushdns then press Enter. This clears stale DNS entries that might interfere.
  4. Restart the computer. After clearing the DNS cache, restart your PC and try renaming again.
  5. Use System Properties. Press Win + R, type sysdm.cpl, and press Enter. Click “Change” under the Computer Name tab, enter the new name, and click OK. This method sometimes works when Settings fails.
  6. Use PowerShell. Open PowerShell as administrator and type Rename-Computer -NewName "YourNewName" (replace with your desired name) and press Enter. Then restart.

If none of these work, try disconnecting from the network temporarily, then rename and reconnect.

Common Mistakes That Trigger the Error

Many users accidentally include a space or an underscore because they are used to naming files that way. For example, My Computer is invalid, but MyComputer or My-Computer works. Another common mistake is using a name that is already in use on the network. If you are on a corporate network, check with your IT department for naming conventions.

Also, some users try to use a name longer than 15 characters, which is the maximum for NetBIOS compatibility. Even if the name appears to work in some contexts, Windows will often reject it during the rename process.

What to Do If the Error Persists

If you have followed all the steps and still see the error, try these additional fixes:

  • Run the network troubleshooter: Settings > Update & Security > Troubleshoot > Additional troubleshooters > Network Adapter.
  • Reset the network stack: Open Command Prompt as admin and run netsh int ip reset and netsh winsock reset, then restart.
  • Check if any third-party security software is blocking the rename. Temporarily disable it and try again.
  • Create a new local administrator account and try renaming from that account.

If the error only occurs when joining a domain, ensure the domain name is correct and that you have the necessary permissions.

Alternatives to Renaming via Settings

If the Settings app keeps giving you the error, you can use the classic System Properties dialog as described above. Another alternative is to use the command line. Open Command Prompt as administrator and type wmic computersystem where name="%computername%" call rename name="NewName" (replace NewName). This method is older but often bypasses the Settings UI glitches.

You can also rename the computer from the PC info page in Settings by clicking “Rename this PC”. If that fails, try renaming from the System page under About.

Frequently Asked Questions

Can I use an underscore in my computer name?

No, underscores are not allowed. Windows 10 only permits letters, numbers, and hyphens. Using an underscore will trigger the invalid name error.

How long can a Windows 10 computer name be?

The maximum length is 15 characters. This is a legacy NetBIOS limit that Windows still enforces. If you try to use a longer name, you will get an error.

What does “The computer name is invalid” mean?

It means the name you entered does not meet Windows naming requirements. It could contain illegal characters, be too long, or be a duplicate on the network.

Do I need to restart after renaming my computer?

Yes, Windows requires a restart to apply the new computer name. You will be prompted to restart immediately or later.

Can I rename my computer without an administrator account?

No, you need administrator privileges to rename a computer. If you are using a standard account, you will be prompted for an admin password.

Why does my computer name revert to the old one after restart?

This can happen if the rename did not complete properly or if a group policy is enforcing a specific name. Check with your IT department if you are on a domain.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →