How to automatically delete 2FA codes on iPhone

Clean up 2FA codes iOS

Automatically deleting verification code texts and emails on your iPhone is now possible with iOS 17 or later installed. When logging into apps and websites, one-time passwords (OTP) often arrive via text message or email. However, these codes become useless after their first use and end up cluttering your device. Apple now makes it possible to automatically remove these texts and emails once they have been auto-filled on the verification screen.

By default this feature is turned off, but you can enable it under Settings. After enabling it, the iPhone will take care of deleting verification code messages. Remember, only codes that are auto-filled by iOS during the signing in process are deleted. If you have to manually type a code, it stays in Mail or Messages.

Follow these steps to automatically delete OTP or 2FA (two-factor authentication) codes from iPhone:

  1. Launch the Settings app
  2. Choose Passwords then authenticate
  3. Tap Password Options
  4. Under Verification Codes, toggle Clean Up Automatically -> ON (green switch)

If you ever need to recover an auto-deleted OTP or 2FA code, these codes can be found in the Trash folder or under Recently Deleted.