TurantToolsdev</> All tools

Large IDs in JSON Lose Precision in JavaScript

9007199254740993 becomes ...992 after JSON.parse: why, and how APIs avoid it.

By the TurantTools Dev team · Updated October 27, 2026 · 3 min read

JavaScript numbers are 64-bit floats, exact only up to 2^53 − 1 (9,007,199,254,740,991). Larger integers, common as database IDs or Twitter/X-style snowflake IDs, silently change when parsed.

Value
ID in the JSON9007199254740993
After JSON.parse in JavaScript9007199254740992
Bits needed54

The last digit changed, and no error was raised.

Fixes

  1. Send large IDs as strings in JSON: {"id": "9007199254740993"}. Many APIs do exactly this.
  2. If you must read numbers, use a parser that supports BigInt, or a reviver with the raw text where available.
  3. Money is safer as integer minor units (cents) or a decimal string, never a float.
Binary, Hex, Decimal & Octal ConverterConvert large numbers between bases.

Sources we checked

Tools in this article

JSON Formatter & ValidatorBeautify, minify, sort keys and find errors by line

More articles