Home > Xiaomi

How to Install MIUI Stock ROM on Xiaomi via TWRP Recovery

In this guide, we will show you the steps to install the MIUI Stock ROM on Xiaomi devices via the TWRP Recovery. There are a plethora of reasons why users prefer to replace their device’s stock recovery with a custom one such as TWRP or OrangeFox. To begin with, you could create a backup of all the partitions on your device. Likewise, you could flash any supported IMG or ZIP file or even root your device by flashing the Magisk ZIP (which is now part of the Magisk App, from v22 onwards).

It is the ability to flash these ZIP files that make the custom recovery the go-to choice for a lot of users. TWRP has made it extremely easy to flash any custom ROM (whether your device is A-only or A/B partition). But when it comes to flashing stock firmware, users opt for the Fastboot Command technique. However, in the case of Xiaomi devices, you could easily flash the stock ROM from the custom recovery itself. This automatically translates to a plethora of benefits.

To begin with, if you are unable to boot the device to OS, then one option is to download the Mi Flash Tool and then flash the firmware accordingly. Or you could manually flash each of the files to their respective partitions via Fastboot Commands. However, both these methods call for quite a lot of manual efforts. This is why users prefer to flash the firmware via TWRP. And in this guide, we will show you how to do just that. So without further ado, here are the required instructions to install the MIUI Stock ROM on Xiaomi devices via the TWRP Recovery.

How to Install MIUI Stock ROM on Xiaomi devices via TWRP Recovery

install xiaomi miui recovery rom using twrp recovery

First and foremost, there are a couple of prerequisites that you need to checkmark. Make sure that you go through each of the below-mentioned requirements and then only proceed with the below steps. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device and data by performing the below steps.

The Prerequisites

  • First and foremost, you need to have the device’s bootloader unlocked and TYWRP Recovery installed as well. This will already be the case with most of our readers. However, if you are yet to do any of these two tasks, then you may refer to the below guides:
  • Next up, take a backup of all the data on your device. This is because the process is going to wipe off the entire data partition (though we wouldn’t be wiping the Internal Storage).
  • Likewise, download the Lazy Flasher ZIP to decrypt the data partition. Download: lazyflasher-no-verity-opt-encrypt.zip. Once you have downloaded it, transfer it to your device.

That’s it, these were all the required files. You may now proceed with the steps to install the MIUI Stock ROM on Xiaomi devices via the TWRP Recovery.

Enable USB Debugging

To begin with, you will have to enable USB Debugging on your device. The former will make your device recognizable by the PC in ADB mode. This will then allow you to boot your device to Fastboot Mode. So head over to Settings > About Phone > Tap on MIUI Number 7 times > Go back to Settings > System > Developer Options > Enable USB Debugging. [Interesting Read: Enable USB Debugging on a Broken Android Devices Screen? Here’s a Workaround!].

Install Android SDK

install adb platform tools windows

Now install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform-tools folder, which will be used in this guide.

Download Xiaomi MIUI Recovery ROM

The OEM has two different types of ROMs: Recovery and Fastboot. As is evident from their names, the Fastboot ROM is flashed via Mi Flash Tool or Fastboot Commands. On the other hand, the Recovery ROM is flashed via stock or custom recovery. And for this guide, you will have to get hold of the Recovery ROM.

So head over to the Xiaomi Official Firmware collection and download the ROM corresponding to your device. Once you have downloaded the ROM, transfer it to your device. If you have a memory card, it is recommended to transfer it there. However, if you don’t have it, then you may transfer it to the phone memory itself.

Boot to TWRP Recovery

Next up, you will have to boot your Xiaomi device to TWRP Recovery so that you could flash the MIUI Recovery ROM. So follow the below steps for that:

  1. Connect your device to the PC via USB cable. Make sure USB Debugging is enabled.
  2. Then head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.
    command-prompt-adb
  3. Type in the following command in the CMD window to boot your device to Fastboot Mode
    adb reboot recovery

    boot xiaomi twrp install miui recovery rom

Flash MIUI Recovery ROM via TWRP

Let’s now flash the MIUI ROM onto your Xioami device via TWRP Recovery. Follow along:

  1. Head over to the Wipe section and tap on Advanced Wipe.
  2. Then select the Dalvik/ART Cache, System, Data, and Vendor partitions and perform a right swipe to perform the wipe.
    twrp advanced wipe install miui stock recovery rom xiaomi
  3. Now go to Install, select the MIUI Recovery ROM and perform a right swipe to install it. [Can’t find the MIUI Recovery ROM? Re-send it via this guide: 3 Methods To Transfer or Install Files via TWRP Recovery].
    install xiaomi miui rom twrp recovery
  4. Once the ROM has been flashed, again go to Install. This time select the lazyflasher-no-verity-opt-encrypt.zip file and perform a right swipe to install it.
    install lazyflasher no verify opt encrypt twrp xiaomi miui rom
  5. When that is done, you may reboot the device to the OS. For that, go to Reboot and select System.

TWRP on some older Redmi devices might show the No OS installed message, well this is just a false positive. You should ignore it and continue to reboot the device to the OS

So this was all from this guide on how to install the MIUI Stock ROM on Xiaomi devices via the TWRP Recovery. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.

Share:
  • Usama Tahir

    Hi, can we use this method to flash MIUI stock rom if we are using a custom rom? Will we have to format data in that case? I am using a A13 custom rom and want to go back to A12 MIUI13 stock rom.

  • Hi,

    I followed all the steps you instructed. However, I ended up stucking in the fastboot mode after installing the MIIUI Recovery ROM. I had tried this multiple times, but they all ended up the same result. I do not know what I did wrong. So I wrote this comment to you for your help.

    P.s. I use the Xiaomi Mi 8 SE device, which I bought from China, and flashed the MIUI 12.5 Global ROM.

    • giuseppe

      you need to flash china miui

      • Hi there! I came across your website, and I must say it has been of great help from the very beginning.
        I discovered my phone (Redmi 6 pro) which I bought from china could receive an update to miui 12.0.4, however, it’s not coming up in the update section of my phone. I tried install the update manually by downloading the recovery room but my device keeps saying “unable to update ROM download and try again”.

        I then decided to use fastboot ROM, but each time I try to flash the ROM to my device, it keeps saying “missmatch image and device”. I followed a YouTube tutorial and deleted the line with the code in the flash_except_storage bat file and I keep encountering anti rollback error.

        I then followed your guide post to know the anti rollback for my device which I saw “anti= ” (no number). I checked the “set current anti” in the bat file and it had no equal to any digit.

        I did notice an error in my device information though. The miui version on it is 10.3.9.0 which when I looked up was for Redmi Note 7 but the unique code of the ROM was still PDMMIXM which is the same in the miui 12.0.4 recovery and fastboot files I downloaded.

        I just hope I’m explicit enough… What could be wrong please?