How to Remove an Office Product Key or Deactivate an Installation

To remove an Office product key, first check how your copy is licensed. The ospp.vbs /unpkey command can remove an installed key from supported Office licensing setups. Microsoft 365 subscriptions also use account sign-in and newer activation data, so removing a key is not always the right way to deactivate them.

Remove Office Key

Which action do you need?

Your goal Start here
Stop using Microsoft 365 on a device Sign out in Office, or use Microsoft’s account page to sign out of that installation remotely.
Remove a specific installed Office key Check the product and key with ospp.vbs before using /unpkey.
Fix an activation error or change a work account Use Microsoft’s activation troubleshooter or your IT team’s reset instructions.
Move Office to another computer Check the licence’s transfer rules. Removing a key does not create transfer rights.

Check the Office product first

Open Word or Excel and look under File → Account for the product name and account. Note whether it says Microsoft 365, a one-time-purchase edition, or a work or school product. Save your work, close Office apps and make sure you can access the account or licence you will need afterwards.

Microsoft’s Office activation tool guide explains the editions supported by ospp.vbs. It is not the tool for managing current Microsoft 365 Apps subscription activation. An Office16 folder name alone does not tell you which licence type you have.

Remove an installed Office key with CMD

Use these steps only for an Office installation that supports ospp.vbs, and only when you are allowed to change its licence. On a managed PC, ask IT first. The last-five-character value identifies an installed key; it is not the full key or a way to get one.

  1. Search Windows for Command Prompt and choose Run as administrator.
  2. Go to the folder containing ospp.vbs. Common Office16 locations are shown below. Use the location that actually exists for your installation.
cd /d "C:\Program Files\Microsoft Office\Office16"

For 32-bit Office on 64-bit Windows, the usual location is:

cd /d "C:\Program Files (x86)\Microsoft Office\Office16"

Check the installed products:

cscript ospp.vbs /dstatus

Read the product name and the last five characters of the key for the entry you want to remove. If there are several entries, do not remove them all without checking what each one is for.

cscript ospp.vbs /unpkey:LAST5

Replace LAST5 with those five characters, with no space after the colon. Run /dstatus again to check the result. If the script is missing or reports no installed keys, do not download a random replacement script or assume that the subscription has been deactivated.

Deactivate Microsoft 365 instead

For a subscription, follow Microsoft’s remote sign-out instructions for your personal or work account. You can also sign out from an Office app. Signing out does not uninstall Office, delete your documents or cancel the subscription.

If the goal is to fix a stuck work-account activation, Microsoft’s activation-reset guide covers different licence and cached-account types. Its cleanup scripts change account information, so follow that guide with IT support rather than deleting registry entries at random.

What key removal does not do

  • It does not make Office free or bypass activation.
  • It does not automatically move the licence to another PC.
  • It does not cancel a Microsoft 365 subscription.
  • It does not guarantee that removing one key clears every activation method on the device.

For installation choices, see our older Office download and support guide or Office LTSC licensing and installation guide. Use the account or purchased licence that matches your product.

Information checked October 13, 2026, using the guides linked above.