Please enable JavaScript to use CodeHS

Phone security

What Is a SIM Swap Attack?How hackers steal your phone number

In a SIM swap, a scammer talks your phone company into moving your number to their phone. Your phone goes quiet, and their phone starts getting your texts, including the login codes that protect your accounts. Here is how it works, how to spot it, and how to lock your number down.

Cybersecurity ~10 min Middle / High school
The basics

Your phone number lives on a SIM

A SIM swap attack is a scam where someone tricks your phone company into moving your phone number onto a SIM card they control. To see why that is such a big deal, you first need to know what a SIM actually does.

Your phone number is not stored inside your phone like a photo. It belongs to your account at a carrier, the phone company that runs the cell network (like the company on your family's phone bill). The carrier keeps a record that says, in effect, "texts and calls for this number go to this SIM."

SIM card

A SIM (Subscriber Identity Module) is a tiny chip that proves to the carrier, "this phone is allowed to use this account." Swap the SIM into another phone and the number goes with it.

eSIM

An eSIM (embedded SIM) does the same job with no plastic card. The carrier sends a digital SIM profile that gets installed on a chip already built into the phone.

The carrier's record

This is the part that matters most. Whoever can change the record "number goes to SIM A" can decide which phone rings when someone calls or texts you.

Moving a number to a new SIM is a normal, useful thing. People do it every day when they break a phone, lose one, or upgrade. Carriers make it easy on purpose. A SIM swap attack abuses that same helpful process.

Simple definition: in a SIM swap, the attacker never touches your phone. They change the carrier's record so your number points to their SIM instead of yours.


Step by step

How a SIM swap works

Most SIM swaps are not high-tech hacking. They are social engineering: tricking a person into doing something by pretending to be someone else. Here the person being tricked is a carrier employee whose job is to help customers.

The attacker gathers facts about you, then contacts the carrier pretending to be you: "I lost my phone, please move my number to this new SIM." If the carrier's checks are weak, or the attacker has enough of your personal details to pass them, the record gets changed. In rarer cases, criminals have bribed store employees to do it. A close cousin is a port-out scam, where the attacker moves your number to a different carrier instead.

Step through the toy model below. Use Send a login code at any point to see which phone the text reaches. Then turn on Number lock and run it again.

Who gets the text?
Diagram: a website sends a code through the carrier network, which delivers it to whichever phone the carrier's record points to. Website login "Text a code to 555-0142" Carrier CARRIER RECORD 555-0142 → SIM A (you) Carrier Your phone (SIM A) No Service Attacker (SIM B)

Step 1 of 5

A normal day

Waiting. Press "Send a login code" to see where it goes.

Key idea: the website did nothing wrong. It sent the code to your number, exactly as asked. The number just doesn't lead to you anymore.



Spot it early

Warning signs, and what to do

The biggest clue is simple: your phone suddenly says No Service or SOS only in a place where it always works. Your Wi-Fi may still work, so apps can look normal at first. Sort each situation below. Is it a red flag, or probably nothing?

Red flag or normal? 0 / 8 correct

    If you think your number was swapped

    1. Act fast. Every minute counts, because the attacker is racing to reset passwords.
    2. Tell a trusted adult, especially whoever manages the phone plan. The account holder is usually the one the carrier will talk to.
    3. Call the carrier from another phone, or use their official app or website over Wi-Fi. Use the number from the carrier's real website or your bill, never one from a text you received.
    4. Secure your email first. From a safe device, change your email password and check its recovery phone and email. Email is the key that opens everything else.
    5. Check other important accounts, like banking, social media, and gaming. Sign out other sessions and switch them to an authenticator app or passkey.

    Defense

    Lock down your number

    You can fight a SIM swap at two points: make the swap itself harder, and make your accounts stop trusting your phone number so much.

    1. Make the swap harder

    • Account PIN or passcode: a secret the carrier asks for before making changes. Pick one that is not your birthday or the last four digits of anything.
    • Number lock / port-out protection: many carriers offer a free setting, with names like "number lock," "SIM protection," or "account lock," that blocks SIM changes and transfers until you turn it off yourself.
    • Share less: attackers pass carrier checks with details like your birthday, address, and phone number. Keep those off public profiles.
    • Never share your carrier PIN or a code by text or phone call. Real carrier support won't contact you and ask for it.

    2. Pick a stronger second step

    An authenticator app makes codes right on your phone, so nothing travels over the phone network. A passkey is a secret key stored on your device that signs you in without any code at all. Compare them below. The bars show how well each one holds up.

    Compare 2FA methods

    Survives a SIM swap
    Survives a fake login page

    3. Check your own setup

    Tick off what you (or your family) have done. The bars show a rough, made-up "attacker signal": how much room you leave for a SIM swapper. It is a toy score to help you prioritize, not a real measurement.

    Account lockdown checklist

      Attacker signal

      Wide open

      Toy model. Real risk depends on your accounts and your carrier.


      FAQ

      Quick answers

      What is a SIM swap attack?

      A SIM swap attack is when a scammer tricks your phone company into moving your phone number onto a SIM card or eSIM that the scammer controls. After that, your calls and texts go to their phone instead of yours. They usually do it to catch the login codes that websites text to you.

      How do I know if my SIM was swapped?

      The biggest sign is that your phone suddenly shows No Service or SOS only in a place where it normally works. Other signs are a message from your carrier about a SIM change you did not make, password reset emails you did not ask for, or being logged out of accounts. If this happens, contact your carrier right away from another phone or over Wi-Fi.

      Can hackers see my photos and apps after a SIM swap?

      No. A SIM swap moves your phone number, not your phone. The attacker does not get your photos, apps, or files. They get your calls and texts, and they use those texts to reset passwords on accounts that trust your number.

      Can a SIM swap happen with an eSIM?

      Yes. An eSIM is a digital SIM, but your number is still tied to your account at the carrier. If a scammer convinces the carrier to move the number to a new eSIM on their phone, the result is the same. The defenses are also the same: a strong account PIN and number lock.

      Is text message two-factor authentication still worth using?

      Yes, it is much better than a password alone, because most attackers will not bother with a SIM swap. But if an account offers an authenticator app, a passkey, or a security key, switch to that instead, especially for your email account.

      How do I protect my phone number from SIM swapping?

      Ask whoever manages your phone plan to set a strong account PIN and turn on the carrier's free number lock or SIM protection feature. Then move important accounts off text codes to an authenticator app or passkey, remove your phone number as a recovery option where you can, and save backup codes somewhere safe.


      Check yourself

      Quick quiz

      1. In a SIM swap attack, what does the attacker actually take over?

      2. Your phone suddenly shows "No Service" at home, where it always works. What is the best first move?

      3. Which second step does a SIM swap NOT help an attacker get past?

      4. What does a carrier's number lock (or SIM protection) setting do?

      Keep learning

      Keep learning

      Learn how security really works

      Protecting a phone number is one small piece of cybersecurity. CodeHS courses teach the full picture, from how networks move data to how defenders think about attacks.

      Part of the Cybersecurity Skills and Careers tutorial series.