Unlocking the bootloader is pretty straightforward on Motorola phones. You need to unlock the bootloader in order to obtain root or install a custom ROM.
Keep in mind, this process will void your warranty. Also, you will lose all of your data on Internal Storage, so make sure to back up everything important before starting.
• Enable Developer Options on your device by going to System > About Phone > Tap on Build Number 5 times
• Open Developer options and enable "USB Debugging" and "OEM unlocking"
• On your PC, download the ADB Tools and extract it
• Also download and install the Motorola USB drivers
• Inside the extracted folder, Shift + Right Click, then select "Open command window here" or "Open PowerShell window here"
• Connect your device to the PC via USB, then in the Command prompt type adb devices
• Check your phone for a prompt and choose "Always allow"
Now you are ready to proceed.
• Boot your device in fastboot mode, either by doing adb reboot bootloader in CMD or by turning on the phone while holding Power + Volume Down
• Type fastboot oem get_unlock_data
• CMD will return 5 strings of characters, something like this:
What you need to do is convert it into one string, like this:
• Copy that string and paste into the official Motorola website. You may need to login.
• Click on "Can my device be unlocked?", then, if it's possible, click on "Request unlock key". You will receive the key via email.
• Go back to CMD and type fastboot oem unlock [your key]. If confirmation is requested, retype the same command.
• Congratulations! Your device is now unlocked.