<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: WhatPhone</title>
    <description>The latest articles on DEV Community by WhatPhone (@whatphone).</description>
    <link>https://dev.to/whatphone</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4254386%2Ff059cb0d-9b0e-498f-82e5-0d3904787693.jpg</url>
      <title>DEV Community: WhatPhone</title>
      <link>https://dev.to/whatphone</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/whatphone"/>
    <language>en</language>
    <item>
      <title>How I Built an Instant Client-Side IMEI &amp; TAC Lookup Tool With Zero Backend Latency</title>
      <dc:creator>WhatPhone</dc:creator>
      <pubDate>Thu, 19 Nov 2026 19:22:49 +0000</pubDate>
      <link>https://dev.to/whatphone/how-i-built-an-instant-client-side-imei-tac-lookup-tool-with-zero-backend-latency-125n</link>
      <guid>https://dev.to/whatphone/how-i-built-an-instant-client-side-imei-tac-lookup-tool-with-zero-backend-latency-125n</guid>
      <description>&lt;ol&gt;
&lt;li&gt;Breaking Down a 15-Digit IMEI&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A standard IMEI is 15 digits long and structured into three parts:&lt;/p&gt;

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

&lt;p&gt;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.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Fast Luhn Validation + Prefix Extraction&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before fetching or searching any data shard, you can validate the structure and extract the TAC prefix right away:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
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 &amp;lt; 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 &amp;gt; 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 &amp;amp; DPR: window.innerWidth, window.innerHeight, and window.devicePixelRatio reveal scaling and responsive breakpoints.

Concurrency &amp;amp; Memory: navigator.hardwareConcurrency and (where supported) navigator.deviceMemory give quick capability hints.

Graphics Context: Creating a temporary &amp;lt;canvas&amp;gt; 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!
&amp;lt;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."/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>webperf</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
