How to remove a pattern lock from Xiaomi without data loss: proven methods of 2026

The forgotten pattern lock on Xiaomi’s smartphone is a situation that one in five users face. The main problem is that most standard instructions suggest resetting the device to factory settings, which leads to the loss of all data β€” photos, contacts, messages. But there are legal ways to get around the lock without formatting memory, if you act carefully and follow proven algorithms.

In this article, we will discuss 5 working methods for unlocking the pattern lock on Xiaomi (including the Redmi Note 12 Pro+, POCO X5 Pro, Black Shark 5 and others) that will save your data. Importantly, the effectiveness of the methods depends on the version of MIUI (12-14), the status of the Mi Account and the availability of debugging over USB. Not all methods are universal – some require preliminary preparation (for example, linking the device to a Xiaomi account).

Before you start, check:

  • πŸ”Ή Is the phone connected to the Internet (Wi-Fi/Mobile data? is critical for Mi Cloud methods.
  • πŸ”Ή Have you previously activated Find the device in your Mi Account settings?
  • πŸ”Ή Is there access to a computer with drivers installed? ADB and Fastboot?

1 Unlocking through Mi Account (official method)

The most reliable method is if your Xiaomi is linked to your Mi Account and it has the Find Device feature enabled. It works on all models with MIUI 10 and later, including Redmi 10C, POCO F4, Xiaomi 13 Lite.

Algorithm of action:

  1. Go to i.mi.com and log in with the same account as you do on your phone.
  2. In the Devices section, select a locked smartphone.
  3. Click Unlock the device β†’ Remove the screen lock.
  4. Confirm the action via SMS or email.

⚠️ Note: If the phone is disconnected, this method will not work, and Xiaomi can request proof of identity (passport scan) if you suspect a hack.

πŸ“Š Your Xiaomi is tied to your Mi Account?
Yes, and Find the Device is on.
Yeah, but the function's off.
No, not tied.
I remember.

2.Use of Fastboot Mode (for advanced users)

The method is suitable if the phone is enabled debugging by USB (Settings β†’ The phone. β†’ Version. MIUI β†’ 7 taps to activate developer mode. Requires a computer with drivers installed ADB and Fastboot.

Step-by-step:

  1. Turn off your phone and press the Power button + Volume down to log into the Fastboot.
  2. Connect the device to the PC and open the command line (Win + R β†’ enter cmd).
  3. Enter the command to check the connection: fastboot devices If the device is displayed, continue.
  4. Delete the file with the pattern lock: fastboot erase gesture.key or for newer versions of MIUI: fastboot erase locksettings.db
  5. Reboot the phone: fastboot reboot

After the reboot, the screen lock will be reset, but the data will remain intact.

Install drivers ADB/Fastboot|Enable debugging on USB phone-on|Download the Android platform SDK|Prepare. USB-cable (original)

-->

3. Unlock via TWRP Recovery (for stitched devices)

If your Xiaomi has a custom TWRP recap, you can manually delete the file with the pattern lock.The method works on the Redmi K50, POCO F3 GT and other models with an unlocked bootloader.

Instructions:

  1. Enter TWRP (Plug Power Button + Volume Up).
  2. Select Advanced β†’ File Manager.
  3. Go to /data/system/ and delete files: gesture.key locksettings.db locksettings.db-wal locksettings.db-shm

Reboot the phone.

⚠️ Attention: Incorrect actions in TWRP If you're not sure, use other methods.

What if TWRP asks for a password?
If you log in to File Manager in TWRP, a password request appears, this means that the /data partition is encrypted, in which case unlocking without loss of data is impossible - you will need to reset through Format Data (all user content will be erased).

4. Bypassing locks through service codes (for older versions of MIUI)

On devices with MIUI 8-11 (e.g. Redmi 5 Plus, Mi A2), service codes sometimes trigger to reset the pattern lock.

Try entering in the dialer:

  • ##7780## - Reset settings (app data will be saved).
  • #3646633## β†’ Engineer Mode β†’ Reset Screen Lock (not available on all models)

If the codes don’t work, move on to other ways.

πŸ’‘

Before entering service codes, check if the keyboard is locked on the lock screen. Try calling an Emergency Call and entering the codes from there.

5. Unlock via ADB (if debugging was enabled)

If the phone is pre-installed on debugging USB, You can remove the pattern lock through ADB It's a data-free method. MIUI 12–14.

Instructions:

  1. Connect your phone to your PC and open the command line.
  2. Enter the commands in turn: adb shell su rm /data/system/gesture.key rm /data/system/locksettings.db rm /data/system/locksettings.db-wal rm /data/system/locksettings.db-shm reboot

Once the reboot is over, the lock will be removed, and if the su command doesn't work, then there's no root permission on the phone.

πŸ’‘

USB debugging should be enabled before the phone locks, and if it's not activated in advance, it won't work.

Comparison of Unlocking Methods

MethodConditions requiredData retentionDifficultySuitable models
Mi AccountAccount binding, Internetβœ… Yes.⭐All of them MIUI 10+
FastbootDebugging by USB, PCβœ… Yes.⭐⭐⭐All with the unlocked bootloader
TWRPSet up recaveri, rootβœ… Yes.⭐⭐⭐⭐Embroidery devices
Service codesMIUI 8–11βœ… Yes.⭐Redmi 4/5, Mi A1/A2
ADBDebugging by USB, PCβœ… Yes.⭐⭐All with MIUI 12+

What do you do if nothing helps?

If neither method works, there are two options:

  1. Contact Xiaomi Service Center with a confirmation of purchase (check or box) They can unlock the phone officially, but the data may be lost.

⚠️ Warning: Do not use questionable unlock programs (such as Mi Account Unlock Tool) that often contain viruses or can permanently block the user from using the software. IMEI device.

FAQ: Frequent questions

Can I unlock Xiaomi without a Mi Account?
Yes, but only if the phone is debugging on USB or installed TWRP. Without these conditions, officially unlock the device without loss of data is impossible.
Why does a Fastboot phone require a password?
This means that the device has File-Based Encryption enabled, in which case unlocking without data loss is impossible – you will need to reset via Recovery.
Does the method work with service codes on the new Xiaomi?
No, on devices with MIUI 12 and later, the service codes for resetting the lock are disabled for security reasons.
Can I recover data after resetting through Recovery?
Partly - if the phone was enabled backup in Mi Cloud or Google Account. Manually restore deleted files (photos, videos) without backup is impossible.
What if Xiaomi asks for an old pattern lock after a reset?
This is a MIUI bug that occurs when you delete your lock files incompletely. Repeat the procedure via Fastboot or TWRP by deleting all files from the /data/system/ folder (see Section 3).