How to Automatically Delete Two-Factor Verification Codes on iPhone in iOS 17 and iOS 18

Logging into online banking, email accounts, and retail websites requires two-factor authentication codes delivered via SMS text messages or email. Over time, these single-use six-digit passwords accumulate by the hundreds, cluttering your Messages conversation list and filling up your Mail inbox with redundant notifications. In iOS 17 and iOS 18, Apple introduced a native feature called Auto-Clean Up that automatically purges verification codes the moment you insert them using keyboard AutoFill.

How the Verification Code Auto-Clean Up Feature Works

Apple’s built-in AutoFill engine detects incoming two-factor authentication codes from both the Messages app and the native Mail app. When an authentication code arrives, iOS highlights the code directly above your digital keyboard, allowing you to insert it into a Safari login form or third-party app with a single tap.

When Auto-Clean Up is turned on, iOS takes an immediate follow-up action behind the scenes. Once you tap the suggested code above the keyboard and submit the authentication prompt, iOS moves the originating SMS message or email directly into your Trash or Recently Deleted folder without requiring any manual deletion.

Steps to Enable Automatic Deletion of Verification Codes

Configuring Auto-Clean Up on an iPhone or iPad takes only a few seconds through your device settings:

  1. Open the Settings app on your iPhone running iOS 17 or iOS 18.
  2. Scroll down and tap Passwords. (You will be prompted to authenticate using Face ID, Touch ID, or your device passcode).
  3. Near the top of the Passwords screen, tap Password Options.
  4. Locate the section titled Verification Codes.
  5. Switch the toggle for Clean Up Automatically to the On position.

From this point forward, every verification code that you successfully apply via AutoFill will be automatically removed from both Messages and Apple Mail.

What Happens If You Need to Recover a Deleted Code?

Occasionally, an online service requires you to re-enter a code or you may want to verify the exact timestamp of an authentication request. Because iOS does not permanently shred the message immediately, you can easily retrieve it from your safety backup:

  • To Recover from Messages: Open the Messages app, tap Filters (or Edit) in the top-left corner, and select Recently Deleted. Select the verification text and tap Recover. Items in Recently Deleted remain accessible for thirty days before permanent erasure.
  • To Recover from Apple Mail: Open the Mail app, tap Mailboxes, navigate to your account’s Trash folder, and locate the notification email.

Important Considerations for Third-Party Email and Messaging Apps

While Auto-Clean Up is exceptionally convenient, it operates under specific privacy and system constraints:

  • Native Apps Only: The automatic deletion process works seamlessly with SMS text messages in the Messages app and email messages handled by Apple’s built-in Mail application. If you view emails exclusively through third-party apps like the Gmail app or Microsoft Outlook for iOS, iOS cannot delete the email on your behalf.
  • AutoFill Trigger Required: A code is only scheduled for automatic deletion if you use the iOS AutoFill suggestion above the keyboard. If you manually open Messages, memorise the code, and type it into the website by hand, the message will remain in your inbox.

Enabling this simple toggle transforms your messaging workflow, preventing digital clutter and keeping your personal communication lists focused entirely on real conversations.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.