1. Breaking Down a 15-Digit IMEI

A standard IMEI is 15 digits long and structured into three parts:

  • TAC (Digits 1–8): The Type Allocation Code identifying the manufacturer, model, and hardware variant.
  • SNR (Digits 9–14): The Serial Number assigned to an individual unit.
  • Check Digit (Digit 15): A Luhn (Mod 10) checksum digit used to catch transposition or entry typos.

From a lookup standpoint, digits 9–14 are unique per unit rather than per model, so model identification hinges on validating the 15-digit format and matching the 8-digit TAC prefix.

  1. Fast Luhn Validation + Prefix Extraction

Before fetching or searching any data shard, you can validate the structure and extract the TAC prefix right away:

 javascript function parseAndValidateIMEI(rawInput) { const digits = rawInput.replace(/\D/g, ''); if (digits.length !== 15) { return { valid: false, reason: 'IMEI must be exactly 15 digits' }; } let sum = 0; for (let i = 0; i < 15; i++) { let n = Number(digits[i]); // Double every second digit from the left (0-based odd index) if (i % 2 === 1) { n *= 2; if (n > 9) n -= 9; } sum += n; } if (sum % 10 !== 0) { return { valid: false, reason: 'Failed Luhn checksum' }; } return { valid: true, imei: digits, tac: digits.slice(0, 8), shardKey: digits.slice(0, 2), serial: digits.slice(8, 14), checkDigit: digits[14] }; } 3. Sharding TAC Data Without Bloat Shipping a single massive JSON or CSV file to the browser slows down parsing and wastes mobile bandwidth. A cleaner pattern is 2-digit prefix sharding: Group records by the first two digits of the TAC (for example, 35, 86, 01) into small static JSON files. Store entries as compact tuples or short arrays ("35481209": ["Brand", "Model", "ReleaseYear"]) instead of repeating verbose property keys on every row. Cache fetched shards in a Map or sessionStorage so repeated checks during a session happen instantaneously. You can see this kind of instant browser-based lookup and device utility workflow in action on WhatPhone.io. 4. Pairing IMEI Checks With Browser Hardware Diagnostics A static TAC database tells you what a model is according to its allocation code, while client-side Web APIs tell you what the current browser environment looks like: Viewport & DPR: window.innerWidth, window.innerHeight, and window.devicePixelRatio reveal scaling and responsive breakpoints. Concurrency & Memory: navigator.hardwareConcurrency and (where supported) navigator.deviceMemory give quick capability hints. Graphics Context: Creating a temporary <canvas> with getContext('webgl') or webgl2 and reading UNMASKED_RENDERER_WEBGL (via WEBGL_debug_renderer_info) helps identify the rendering GPU when available. Because all of this runs locally in memory, users don't have to send sensitive device identifiers to an external backend just to run a quick check. Trade-Offs to Keep in Mind Client-side architectures shine for read-heavy, low-latency utilities, though they come with real trade-offs: Dataset Updates: Static shards require a build/deploy step whenever new TAC allocations are added. Incomplete Coverage: Newer or regional models may appear in carrier or manufacturer databases before showing up in static reference files. API Restrictions: Some browser hardware signals are restricted or generalized across browsers for privacy protection, so treat them as diagnostic hints rather than guarantees. If you've built client-side search or sharded static datasets in production, how did you balance initial bundle/shard size against lookup speed? Let's discuss in the comments! <FollowUp label="Want me to write a follow-up post on optimizing static JSON shard sizes and caching?" query="Write a technical DEV.to blog post about compressing, sharding, and caching large static JSON lookup datasets in the browser with links to whatphone.io."/>