How to Root Moto G 5G and Unlock Bootloader (Guide)

We are back with a new root guide for Motorola users. Here you will know how to root Moto G 5G phone with Magisk. There are many Motorola phones available in a budget category. And Moto G 5G is a great addition to the list. It is one of the cheapest Android phones that offers 5G support. And if you have the Moto G 5G, then this guide is for you. We will also share the guide to unlock bootloader of Moto G 5G.

Motorola devices are popular, especially the G series which is keeping Motorola in the market. The company knows it better and they are focusing on more budget Android phones. And do you know you can root your phone to get even more out of your phone? You can boost the performance of your Moto G 5G.

Motorola phones come with near Stock Android UI with minimum customization option. And rooting allows users to customize their phones as per the need. Some basic features of rooting are the support for custom fonts, custom boot animation and third party themes, and more. But for rooting an Android phone, Unlocking bootloader is mandatory so I will also share the guide to Unlock Bootloader of Moto G 5G.

How to Root Moto G 5G

There are only some OEMs that allow users to easily root their phones. And luckily Motorola phones are easier to root using the Magisk tool. Rooting is still a great option for Android users who are getting updates late and don’t have the option to switch to a custom ROM. You can change the appearance or theme of your phone after rooting your device. Before the rooting guide, we’ll be sharing the guide on how to unlock bootloader of Moto G 5G.

Moto G 5G Unlock Bootloader

All Android phones from different OEMs come with locked bootloader by default. It means Moto G 5G also comes with locked bootloader by default. Locked bootloader restricts from modifying the device including the rooting process. And fortunately, Motorola allows you to easily unlock bootloader. You can follow the below guide on how to unlock bootloader of Moto G 5G.

  1. Take a backup of your Moto G 5G as unlocking bootloader will delete all the data.
  2. Install ADB & Fastboot drivers and Motorola USB Driver on your PC.
  3. Now open Settings on your phone and go to About Phone. Tap about 7-8 times on Build Number, and it will show ‘You are now a developer.’
  4. After enabling the developer option, go back to Settings and then go to System > Developer Options. In Developer options, enable OEM Unlocking and also enable USB Debugging.How to Unlock Bootloader of Moto G 5G
  5. Turn off your device. Press & hold Volume Down + Power button together to boot Moto G 5G into Fastboot Mode.
  6. And when the Fastboot screen appears on the phone, release both buttons. Connect your phone to your PC after booting into Fastboot.
  7. Now open the Command window or CMD on your computer. Open Command window from Platform Tools location in case of macOS and Linux.
  8. Enter the below command in the Command/PowerShell window
    • fastboot oem get_unlock_data
  9. It will display 5 line code. Copy the code and make it in one line, use notepad for convenience. Remember not to copy (bootloader) in case of windows and Info in case of Mac.
  10. Go to Motorola unlock page and click next and login with the Motorola account.
  11. Copy the one-line code that you just adjusted in Notepad and paste it into the Motorola unlock page.How to Unlock Bootloader of Moto G 5G
  12. Click on ‘Can my device be unlocked’ and then click ‘Request Unlock Key’ (make sure to select I Agree).
  13. Then you will receive a code via mail (Motorola account ID). Copy the code and paste in place of ‘code’ without inverted commas in the below command and press Enter
    • fastboot oem unlock 'code'
  14. Entering the above command will unlock bootloader on Moto G 5G. It will erase all the data on your phone. After unlocking the bootloader, reboot, and set up your device.

After Unlocking the bootloader of your Moto G 5G, you are all set for rooting. But for rooting you will need some files and tools mandatory for the guide. So make sure to first go through the below prerequisite section and get all required data.


  • Make sure to Unlock Bootloader of Moto G 5G
  • Take a full backup of data to restore if anything goes wrong
  • Charge your phone to at least 50%
  • Download Canary Magisk Manager APK
  • Download the Moto G 5G Firmware for your phone (the same version which is installed on your phone)

Steps to Root Moto G 5G

  1. After downloading the firmware, extract the Moto G 5G firmware on your computer.
  2. Find the boot.img file from the extracted folder and copy it to your phone storage.
  3. Now install the Magisk Manager Canary app on your phone. And open the Magisk Manager app.
  4. Then click on the first Install and again click on Install.How to Root Moto G 5G
  5. It will ask for the method, so choose ‘Select and Patch a File’ from the option.How to Root Moto G 5G
  6. Now browse and select the boot.img file, and it will start patching the boot image.
  7. The output file will be stored in the download folder with the name magisk_patched.img.
  8. Copy the patched boot image file to your computer in folder C:\adb. Also, rename the patched file to boot.img.
  9. Reboot your Moto G 5G to Fastboot mode and connect it to your computer. Follow the steps given in the unlock bootloader guide above.
  10. In the C:\adb folder (or platform-tools folder) press Shift + Right click on an empty area and select ‘Open Command window here’ or ‘Open PowerShell window here.’How to Root Moto G 5G
  11. Enter the below command in the Command/PowerShell window to check the device is connected or not, entering command should return some number id.
    • fastboot devices
  12. Now enter the below command to flash Magisk and root Moto G 5G.
    • fastboot flash boot boot.img
  13. After that, reboot your device to the system.
  14. If the Magisk Manager is not installed on your phone, then install the app. Skip if the app is already present.
  15. Complete the in-app instructions, and the device will automatically reboot into the system.

After rooting your phone, you can check in the Magisk app for the root status. On the app, it should show green ticks for both Magisk and Magisk Manager.

Now you can use all the root features on your Moto G 5G. You can remove Ads, uninstall bloatware, and even more functions. And if you want to customize your phone or install Xposed Modules then you can use Xposed Framework on your phone.

You May Also Like | Download Google Camera 6.1 for Motorola Devices [Latest APK]

So there you have it, the guide on how to root Moto G 5G along with the guide to Unlock Bootloader of Moto G 5G. If you have any queries then let us know in the comment section.

More Guides on Motorola:

Explore Stories


Photo of author

Ashutosh singh

Computer Science graduate and tech enthusiast. Love testing new tech gadgets ever since my first windows phone from Samsung. Working as a technical writer for more than five years, and I believe I have also developed good SEO skills. In my spare time, I like watching movies, and playing games.

Leave a Comment