Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 5 min read

US Carrier: T-Mobile / Metro Lock & Unlock

US Carrier: T-Mobile / Metro Lock & Unlock T-Mobile and Metro by T-Mobile enforce network locks through SIM-lock flags, subsidy records, and eligibility checks keyed to a 15-digit IMEI. T-Mobile unlocks a postpaid devi

US Carrier: T-Mobile / Metro Lock & Unlock

T-Mobile and Metro by T-Mobile enforce network locks through SIM-lock flags, subsidy records, and eligibility checks keyed to a 15-digit IMEI. T-Mobile unlocks a postpaid device after 40 days of active service and full payoff (prepaid: 365 days); Metro requires 180 days. Each carrier-registry lookup returns in under 5 seconds, anchored to the IMEI's Luhn mod-10 checksum and TAC.

How a carrier lock is enforced

A carrier lock (also called a SIM lock or network lock) is a firmware-level restriction stored in the device's baseband processor. When a SIM is inserted, the modem compares the SIM's IMSI-derived MCC/MNC pair against the allowed set burned into the lock table. If the home network does not match, the modem blocks registration on the visited network and returns a "SIM network unlock PIN" prompt.

The lock is not stored in the SIM β€” it lives in the device. That distinction matters: swapping in a competitor's SIM does not unlock the handset. The unlock state is flipped by the carrier's device-entitlement server, which consults an IMEI-keyed record to decide whether the device has satisfied its eligibility rules. On iPhones the change is server-side (Apple's activation/GSX pipeline reads the carrier's eligibility response); on most Android handsets T-Mobile ships a preloaded Device Unlock app that queries the same entitlement backend.

IMEI structure and the Luhn checksum

Every eligibility lookup starts with the IMEI (International Mobile Equipment Identity), a 15-digit identifier split into three fields: an 8-digit TAC (Type Allocation Code) that names the model and manufacturer, a 6-digit serial number, and a final Luhn mod-10 check digit. The TAC is allocated by the GSMA, which is why the first eight digits can identify the handset class before any carrier record is read.

The check digit is computed with the Luhn algorithm, the same mod-10 scheme used by card issuers. Validating it locally rejects typos before a lookup is sent:

def luhn_ok(imei: str) -> bool:
    """Validate a 15-digit IMEI via the Luhn mod-10 checksum."""
    digits = [int(d) for d in imei if d.isdigit()]
    if len(digits) != 15:
        return False
    total = 0
    for i, d in enumerate(reversed(digits)):
        if i % 2 == 1:          # double every second digit from the right
            d *= 2
            if d > 9:
                d -= 9
        total += d
    return total % 10 == 0

print(luhn_ok("490154203237518"))  # True β€” valid check digit

A device whose check digit fails this test is either mistyped or has been tampered with at the IMEI level; a legitimate carrier registry rejects it outright.

T-Mobile and Metro network identifiers

The table lists the MCC/MNC pairs and radio parameters that appear in a T-Mobile or Metro lock table, alongside the eligibility thresholds that gate unlocking.

Parameter T-Mobile postpaid T-Mobile prepaid Metro by T-Mobile
MCC / MNC 310 / 160, 200, 210, 220, 230, 240, 250, 260, 270, 310, 490 310 / same pool 311 / 660 (legacy), 310 / 260
Minimum active service 40 days on the requesting line 365 days since activation 180 days
Payoff requirement Financed/leased device must be paid in full Not applicable Device must be paid off
Primary LTE bands 2, 4, 5, 12, 25, 26, 41, 46, 66, 71 same same
Primary 5G (NR) bands n41, n71, n25, n66, n258/n260/n261 n41, n71 n41, n71
Unlock delivery Server-side (iPhone) or Device Unlock app (Android) Same Same

The unlock process (FCC-regulated)

Carrier unlocking is a regulated, legal process in the United States. Under the FCC's unlock framework adopted in 2014 and extended since, carriers must unlock eligible devices free of charge once the customer's obligations are met. There is no legitimate numeric "unlock code" to type into a modern T-Mobile or Metro device β€” numeric codes were a legacy GSM-era mechanism. Today the carrier flips an entitlement flag and the device unlocks itself over the network.

The eligibility rules are deterministic. T-Mobile requires the device to have been sold by T-Mobile, to have been active on the network for at least 40 days, to be fully paid off if financed, and to not be reported lost, stolen, or blocked. Prepaid lines must show 365 days of service. Metro by T-Mobile applies a 180-day active-service requirement. When those conditions are met, the unlock is free.

Checking status before you act

Before contacting the carrier or buying a used device, the practical first step is a status check. The production diagnostic endpoint at iunlockmobile.com/check/t-mobile-us returns the current GSX and carrier-registry state for a T-Mobile or Metro IMEI β€” lock status, blacklist flag, and eligibility β€” in a few seconds. If the device is still financed or otherwise ineligible, the US unlock reference documents the policy thresholds so the owner can confirm what remains before re-requesting.

{
"@context": "https://schema.org",
"@graph": [
{
"@type": "TechArticle",
"headline": "US Carrier: T-Mobile / Metro Lock & Unlock",
"description": "Engineering reference on T-Mobile and Metro by T-Mobile network lock enforcement, IMEI structure and Luhn checksum, MCC/MNC identifiers, and the FCC-regulated unlock process.",
"datePublished": "2026-11-29",
"dateModified": "2026-11-29",
"author": { "@type": "Organization", "name": "iUnlockMobile", "url": "https://iunlockmobile.com" },
"publisher": { "@type": "Organization", "name": "iUnlockMobile", "url": "https://iunlockmobile.com" },
"mainEntityOfPage": "https://iunlockmobile.com/check/t-mobile-us"
},
{
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "Is there a free T-Mobile unlock code available?",
"acceptedAnswer": { "@type": "Answer", "text": "No numeric code applies to modern devices. T-Mobile unlocks eligible devices free of charge by flipping a server-side entitlement flag (iPhone) or via the preloaded Device Unlock app (Android)." }
},
{
"@type": "Question",
"name": "Can I unlock my T-Mobile phone myself?",
"acceptedAnswer": { "@type": "Answer", "text": "Yes. You can request the unlock yourself through the Device Unlock app or T-Mobile support; the carrier's entitlement server applies it once the 40-day and payoff requirements are met." }
},
{
"@type": "Question",
"name": "What is the T-Mobile unlock code?",
"acceptedAnswer": { "@type": "Answer", "text": "Legacy GSM devices used a numeric network-unlock code. Current T-Mobile and Metro devices are unlocked server-side rather than by typing a code." }
},
{
"@type": "Question",
"name": "What is the T-Mobile SIM network unlock PIN?",
"acceptedAnswer": { "@type": "Answer", "text": "The prompt appears when the modem blocks a non-home SIM. On current devices the carrier clears it by flipping an eligibility flag; there is no user-entered PIN." }
},
{
"@type": "Question",
"name": "Can I get a free Metro network unlock code?",
"acceptedAnswer": { "@type": "Answer", "text": "Metro by T-Mobile unlocks eligible devices free after 180 days of active service via the same server-side mechanism; no manual code is issued." }
},
{
"@type": "Question",
"name": "Can I unlock my T-Mobile iPhone myself?",
"acceptedAnswer": { "@type": "Answer", "text": "Yes. iPhone unlocking is server-side through Apple's GSX/activation pipeline; once T-Mobile marks the IMEI eligible, the iPhone unlocks automatically after a carrier settings refresh." }
},
{
"@type": "Question",
"name": "How to unlock Metro network?",
"acceptedAnswer": { "@type": "Answer", "text": "Meet the eligibility rules (180 days active service, device paid off, account in good standing), then request the unlock; the carrier applies it server-side." }
},
{
"@type": "Question",
"name": "What is the unlock code for T-Mobile?",
"acceptedAnswer": { "@type": "Answer", "text": "There is no static code. Unlock is an IMEI-keyed entitlement that T-Mobile's backend flips once the device satisfies the unlock policy." }
},
{
"@type": "Question",
"name": "Can I unlock my T-Mobile phone for free?",
"acceptedAnswer": { "@type": "Answer", "text": "Yes. Unlocking is free when the device meets the eligibility requirements (40 days postpaid or 365 days prepaid, paid off, and not reported blocked)." }
},
{
"@type": "Question",
"name": "Can I just put my T-Mobile SIM card in an unlocked phone?",
"acceptedAnswer": { "@type": "Answer", "text": "Yes. An unlocked or T-Mobile-compatible device will accept a T-Mobile SIM; the SIM lock binds the device, not the SIM." }
}
]
}
]
}

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.