Android normally secures your device by demanding a PIN, pattern, or full password. Your phone isn’t useless if you forget the unlock code — you can bypass it and get back in.
As Google tightens security, this has become more difficult on modern versions of Android. But there’s always a way to make your phone usable again, as long as you remember your Google account’s username and its password.
Modern Versions of Android (5.0 and Up)
Android used to have a way to bypass your PIN or password, but that feature was removed in Android 5.0.
Unfortunately, this means there’s no built-in way to simply reset your pattern, PIN, or password and gain access to your phone or tablet. This does help provide additional protection to your data, however — attackers have no way of bypassing the passcode unless they actually know it.
Update, 9/23/22: Android 13 was released in August 2022. Android 13 does not contain any features that are comparable to the recovery methods present in older versions of Android from before Android 5.0, either.
Android’s Smart Lock feature may be able to save you. For example, let’s say you’ve set up Smart Lock on your Android phone and have it automatically log in when it’s on your home Wi-Fi. You can take your phone to that home Wi-FI network and it will automatically unlock for you, even if you can’t remember the normal unlock code.
You’re left using a few other tricks that might work. For example, on Samsung devices, if you’ve logged into the device with a Samsung account, you can go to the Samsung Find My Mobile website, log in with the same Samsung account, and use the “Unlock my screen” option to remotely remove your device’s lock screen. Other manufacturers might potentially offer similar features if they have a device-tracking website you’ve signed up for.
If you’ve already unlocked your bootloader and installed a custom recovery, you may be able to use that environment to remove the code. However, it probably won’t be possible to install a custom recovery without factory resetting your device if you haven’t already done so.
Android 4.4 and Below
Older versions of Android — Android 4.4 KitKat and older — have an integrated way to bypass your pattern, PIN, or other password if you forget it. To find this feature, first enter an incorrect pattern or PIN five times at the lock screen. You’ll see a “Forgot pattern,” “forgot PIN,” or “forgot password” button appear. Tap it. You’ll be prompted to enter the username and password of the Google account associated with your Android device.
When All Else Fails: Factory Reset Your Device
Assuming you don’t have the easy option to reset the device using one of the tricks above, you should probably give up on the data stored on your device. You can get your device into a usable state again, but that will involve performing a factory reset, wiping the device’s storage, and setting it up again from scratch.
This isn’t as bad as it sounds, as most data on a modern Android device should just sync online. Sign in with the same Google account and you’ll have access to your emails, contacts, apps, and practically everything else. You’ll then be able to set up a new unlock code.
If your device has a removable SD card, you’ll probably want to remove the SD card before performing the factory reset, just to ensure any files stored on there won’t be overwritten. It’s probably best to shut down your Android device, remove the SD card, and then continue.
You can visit the Find My Device website and log in with the same Google account you use on that Android device. Select the device you’re locked out of and select “Erase” to remotely erase it. You’ll be able to set it up from scratch afterwards — the lock code will be removed, but the device will also be wiped.
If you’ve enabled another remote phone or tablet-tracking service, you can probably use its website to remotely wipe your device, too.
If you can’t reach your phone via the Find My Device page to perform a reset, don’t worry — you have other options. You can factory-reset your phone or tablet even if you can’t unlock it.
The exact way you’ll do this is different on different phones and tablets. You’ll need to boot into your device’s system recovery menu and wipe it from there. To do this, you’ll need to turn the device off and turn it on while holding the correct buttons. For example, on the Pixel 6, you have to press and hold the Volume Down and Power buttons at the same time, then, when you see “No Command,” quickly hold the Volume Up button and the Power button. Use the recovery menu to wipe the device.
Google offers a list of ways to access recovery mode on Pixel devices. You may have to perform a web search or check your device manufacturer’s support pages to find out how to reset it.
On devices running Android 5.1, you may have to enter the username and password of the Google account that was previously associated with the device after doing this. This prevents someone else from resetting and using your device. However, you won’t need the old unlock code to regain use of your hardware.
Modern Android devices work a lot more like Apple’s iPhones and iPads. If you forget the code, you’ll need to reset it to its factory default settings to regain access. This begins to make sense when you consider Google’s desire to automatically encrypt all Android devices out-of-the-box. The PIN or password is used as part of the key to decrypt the data stored on an encrypted Android device.