How to unlock digital code on Xiaomi phone: the full guide 2026

The forgotten digital code on Xiaomi’s smartphone is a problem that thousands of users face every day, unlike a pattern lock or a fingerprint, PIN-The code blocks access to all device functions, including calls and SMS. But don’t panic: There are at least 5 working ways to unlock, and most don’t require special skills.

It is important to understand that the methods differ depending on the version of MIUI, the phone model (Redmi Note 12, POCO X5, Mi 11, etc.) and whether the device is linked to the Mi Account. In this article, we will discuss all the current methods - from official (through access restoration) to technical (using fastboot and ADB), and you will learn how to avoid data loss and what to do if the phone requires confirmation after a reset.

Warning: some methods lead to a complete memory cleanup. If your device stores important data, try the options without resetting first. And remember, the newer Xiaomi model, the harder it is to bypass security due to the improved security protocols in MIUI 14/15.

1 Unlocking through Mi Account (official method)

The most reliable and recommended method Xiaomi is to restore access through an attached Mi Account, which works if:

  • πŸ“± The phone is connected to the Internet (Wi-Fi or mobile network).
  • πŸ”‘ Remember the username and password from Mi Account.
  • πŸ”„ Synchronization is enabled on the device (checked in the account settings).

Instructions:

  1. On the lock screen, click Forgot Password? (or Forgot Password? on English firmware).
  2. Choose Restore through Mi Account.
  3. Enter the email or phone number associated with the account.
  4. Confirm the entrance through SMS-code.
  5. Create a new one. PIN-code.

If the option is forgotten password? is missing, it means:

  • 🚫 The phone is disabled synchronization with Mi Account.
  • 🌐 No Internet connection (check if the network indicator is on).
  • πŸ”§ The device is operated by custom firmware (unofficial).
πŸ“Š How often do you forget passwords from your devices?
Often, once a month.
Sometimes, every six months.
Nearby, but I remember.
Never forget.

⚠️ Note: After 5 failed attempts to enter a password, Xiaomi can block the ability to restore through Mi Account for 24 hours.

2.Reset via Recovery Mode (Hard Reset)

Hard reset is a universal way to unlock, but it removes all data from the device, including photos, contacts and apps, and is suitable for Redmi, POCO and Mi models on any version of MIUI.

Step-by-step:

  1. Turn off the phone with a long press on the power button.
  2. Click the combination: For most models: Power button + Volume up. For older devices (Redmi 4X, Mi A1): Power button + Volume up + Volume down.

Mi

Recovery Mode

Wipe Data

Clear Data

Wipe All Data

Reboot

β˜‘οΈ Preparation for Hard Reset

Done: 0 / 4

After restarting, the phone will require:

  • πŸ”‘ Data entry from Mi Account if it was linked.
  • πŸ“± Configure as a new device (language selection, Wi-Fi connection, etc.).

⚠️ Note: On devices with Qualcomm Snapdragon chip (e.g, POCO F5, Redmi Note 12 Pro+) Hard Reset may cause a "This device is locked" error, which means that the phone is tied to a Mi Account and you can't unlock it without it.

3. Unlock through ADB (for advanced users)

The Android Debug Bridge (ADB) method is suitable if the phone is enabled with USB debugging and has access to the computer.

What you need:

  • πŸ’» A computer with installed Xiaomi drivers and ADB Tools.
  • πŸ”Œ USB-cable (original, without damage).
  • πŸ“± Phone with debugging enabled (configured in Settings) β†’ The phone. β†’ Version. MIUI β€” 7 times to unlock the developer menu).

Instructions:

  1. Connect your phone to your PC via USB.
  2. Open the command line (Win + R β†’ cmd) and type: adb devices If the device appears in the list, go further.
  3. Enter the commands in turn: adb shell su rm /data/system/gesture.key rm /data/system/password.key rm /data/system/locksettings.db rm /data/system/locksettings.db-wal rm /data/system/locksettings.db-shm reboot
  4. After restarting, the phone will unlock.
What if the ADB can’t see the device?
1. Check if debugging is included on USB 2. Install drivers for your Xiaomi model (download from the official website). 3. Try another one USB-cable or port. 4. Restart your computer and phone.

If after execution of commands the phone still requires a password, it means:

  • πŸ”’ The device uses hardware encryption (starting with the MIUI 12).
  • πŸ“± No root rights (the su team did not work).

4.Use of the Find Device service (remote unlock)

Xiaomi offers the official Find Device service, which allows you to unlock your device remotely.

  • πŸ“ The phone includes geolocation and mobile Internet.
  • πŸ”— The device is tied to the Mi Account.
  • πŸ”‹ Battery level above 15%.

How to unlock:

  1. Go to i.mi.com and log in.
  2. Select a locked phone from the list of devices.
  3. Press Find the device. β†’ Unlock.
  4. Confirm the action via SMS or email.
  5. Wait for a notification of successful unlocking (can take up to 5 minutes).

Limitations of the method:

  • 🚫 It does not work on devices with the Internet off.
  • πŸ”„ After unlocking, you may need to re-enter the password from the Mi Account.
  • πŸ“± In some models (POCO X3 Pro, Redmi K50) default.

πŸ’‘

If Find Device does not find your device, check if the device search option is enabled in the security settings (Settings β†’ Memory and Security β†’ Device search).

5. Unlock via Fastboot (for tech-savvy)

The Fastboot method is suitable for devices that have OEM Unlock protection turned off (usually models until 2020), which requires unlocking the bootloader and leads to a complete data reset.

What you need:

  • πŸ’» Computer with Mi Flash Tool and drivers installed.
  • πŸ”Œ Original. USB-cable.
  • πŸ“„ Firmware for your model (download from the official website).

Step-by-step:

  1. Turn off your phone and put it into Fastboot mode: Press Power Button + Volume Down. Connect to your PC - should be defined as a Fastboot device.

Mi Flash Tool

Refresh

Clean All

Flash

On Xiaomi models 2021-2026 (e.g. Redmi Note 13, POCO F6), unlocking the bootloader requires confirmation via Mi Account and waiting 7-15 days after filing an application.

⚠️ Warning: Continuous interruption of the firmware process via Fastboot can cause a device to "break down." If the process indicator is stuck 99% longer than 10 minutes, do not turn off the cable - wait for the automatic restart.

6. Alternative methods (for specific cases)

If standard methods don’t work, try these options:

MethodConditionsRisks.
Reset via EDL ModeYou need an authorized Xiaomi developer account and a special cable.High risk of IMEI blocking.
Use of TestPointIt's good for the Redmi 5/6/7 series, so you need to close contacts on the board.Requires disassembly of the phone, risk of damage.
Contacting the service centerIf the phone is warranty or data retention is required.Paid service (from 1000 to 5000) β‚½).
FRP Bypass exploitIt works on older versions of MIUI (up to 11th).It might not work the first time.

For methods with disassembly of the phone (TestPoint, EDL), we recommend contacting specialists. Wrong actions can lead to:

  • πŸ”₯ Battery overheating.
  • πŸ“΅ Poose. IMEI (The phone won't catch the network).
  • πŸ’€ Complete failure of the motherboard.

πŸ’‘

If the phone is locked after buying from hands, check it for binding to other accounts through the service Mi Verify. Devices with active binding to the Mi Account of the previous owner can not be unlocked without his data.

Frequent mistakes and their solutions

When you unlock digital code on Xiaomi, users face typical problems.

"This device is locked after Hard Reset"

The error appears on devices with Mi Account tied.

  • πŸ”‘ Enter the account that was linked to the phone.
  • πŸ“§ If you forget your password, restore it through account.xiaomi.com.
  • πŸ“ž If you have purchased your phone from hand, contact the previous owner.

ADB does not see the device

Connection problems are solved as follows:

  • πŸ”Œ Check the cable (use the original from Xiaomi).
  • πŸ–₯️ Reinstall drivers via Mi PC Suite.
  • πŸ”„ Turn on/off debugging on USB developer-setting.

The phone is not included in Recovery Mode

Possible causes:

  • πŸ”‹ Battery discharged (charge to at least 30%).
  • πŸ”§ Faulty buttons (try to connect the keyboard on the OTG).
  • πŸ“± Device "bricked" (requires firmware through the EDL).
Can I unlock Xiaomi without losing data?
Yes, but only if: πŸ”“ The phone's debugging on. USB and have access to ADB. πŸ“± The device is synced with the Mi Account and has Internet access (you can use Find Device, POCO X5) s MIUI 14+ The chances of saving data are minimal due to hardware encryption.
What to do if you forget your Mi Account password?
Restor access via the official website: Go to account.xiaomi.com. Click Forgot Password?. Enter email or phone number associated with the account. Confirm recovery via SMS or backup email. If the account is not yours (phone bought by hand), contact the previous owner or contact Xiaomi support with proof of purchase.
How much does it cost to unlock in the service center?
The cost depends on the model and method: πŸ’° Reset via Mi Account: Free. πŸ’° Hard Reset: 500–1500 β‚½ (If you need specialist assistance). πŸ’° Firmware through EDL/TestPoint: 2000–5000 β‚½. πŸ’° Unlocking the loader: 1000–3000 β‚½ (if waiting is required 7–15 Xiaomi official service centers may refuse to unlock if the phone is tied to someone else’s account.
Can I unlock Xiaomi through my Google Account?
No. Starting with MIUI 9, Xiaomi removed the unlock support through Google Account. Now the only official way is to restore through Mi Account. Exception: on very old models (Redmi 3S, Mi 4) sometimes bypasses through FRP Bypass, but this is not guaranteed.
How to avoid blocking in the future?
Follow these recommendations: πŸ” Use a fingerprint or facial recognition as the primary method of unlocking. πŸ“ Write it down. PIN-code in a secure location (for example, in a password manager). πŸ”„ Regularly back up through Settings β†’ Memory and backup copies. πŸ”— Link the phone to Mi Account and enable synchronization.