Note: Unlocking deletes all data. So take backup of all your required data.
Download the Android SDK or the minimal ADB and Fastboot (The latter is recommended).
Install Motorola adb and fastboot drivers.
Power down the phone.
Press down Vol Down button, and press Power down too. Keep them pressed and release Power button followed by Vol down button. This lets you enter the Fastboot mode.
Connect the phone to PC with a cable, enter command prompt (In Win 8+, type cmd in Start screen).
Add fastboot.exe and adb.exe to the path.
In a commmand prompt, enter the following, and copy the required data:
fastboot oem get_unlock_data
Visit the unlocking site.
Sign in using your Google account or Motorola ID.
Paste the string copied earlier, in the field.
Click on ‘Can my device be unlocked?’.
Click on the “REQUEST UNLOCK KEY” button.
Select the ‘I Agree’ option. The unlock key will be delivered to your email.
With your device still connected, in command prompt, type:
fastboot oem unlock KEY
replacing KEY with the actual key you received.
For more, Read this XDA post by Lucas Eugene.
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.