Resource center
Deactivate and transfer a Microsoft license
Retail keys move freely between machines as long as you deactivate the old PC first. OEM keys can't be transferred.
Windows — remove the key
Open elevated PowerShell on the old PC and run: slmgr /upk (uninstall product key) then slmgr /cpky (clear from registry). Reactivation will prompt for a key on the new PC.
Office — sign out and uninstall
In any Office app: File → Account → Sign out. Then Control Panel → Programs → uninstall Office. Online, visit account.microsoft.com/services to detach the install slot.