JSON Size Analyser
Inspect UTF-8 payload sizes, character lengths, container counts, and compression savings 100% in-browser.
- Runs in your browser
- Free, no signup
Raw Payload Metrics
Structural & AST Breakdown
Value Types Distribution
Minification & Overheads
Analysis runs entirely in your browser using local JavaScript and TextEncoder — your JSON payloads and schemas are never uploaded to any server.
Optimizing API payload sizes, database column limits, and network transfer costs requires an accurate understanding of JSON structure. This tool provides an exhaustive breakdown of raw byte weights, Unicode character counts, Abstract Syntax Tree (AST) node distribution, and potential minification savings.
Paste any JSON document to inspect UTF-8 bytes calculated via browser TextEncoder APIs, total and unique object keys, maximum nesting depth, array elements, and primitive type distributions. Identify oversized string fields and evaluate exact whitespace savings before pushing data to production APIs.
How to use this tool
- Paste your JSON payload into the input editor or click "Load Sample" to inspect an example analysis.
- Review the Raw Payload Metrics card for exact UTF-8 byte weight, UTF-16 code units, and Unicode code points.
- Inspect the Structural & AST Breakdown to evaluate object counts, array lengths, key totals, and maximum nesting depth.
- Examine the Minification & Overheads card to compare raw input size against compact minified JSON and calculate whitespace savings.
- Click "Copy Analysis" to copy a formatted text summary of all metrics directly to your clipboard.
UTF-8 Byte Weight vs. String Character Counts
In JavaScript, string.length reports UTF-16 code units, which does not reflect actual network transfer sizes or storage footprints when multi-byte UTF-8 characters (such as emojis, accented characters, or non-Latin scripts) are present. A single character can consume between 1 and 4 bytes in UTF-8.
ToolDuck computes the true payload size using the browser native TextEncoder API, ensuring exact byte parity with network wire sizes, Content-Length headers, and database VARCHAR/BLOB thresholds.
AST Node Distribution and Nesting Depth Insights
Deeply nested JSON trees create memory pressure, degrade client deserialization performance, and risk stack overflow errors in recursive parsers. The analyzer traverses your document with a bounded stack algorithm to determine maximum nesting depth.
It also tallies total objects, total arrays, and counts every unique key name. If your schema re-uses the same key names repeatedly across large arrays, minification or schema refactoring may unlock substantial bandwidth optimizations.
Precise Minification and Whitespace Savings Calculation
Formatted JSON with indentation and newlines is essential for developer readability during local development, but in production, redundant whitespace bloats network transfers. The analyzer compares your current input size with its zero-whitespace minified counterpart.
It displays the exact byte difference and percentage reduction achievable by stripping formatting, helping you decide whether to enable client or server-side minification.
Complete Confidentiality for Production Payloads
Performance auditing often requires inspecting proprietary production payloads, user records, or financial transaction logs. Pasting these into third-party web services risks data leakage and regulatory non-compliance.
Every calculation runs 100% client-side in your local browser sandbox. Inspect your browser developer console or network tab—not a single byte of your data is ever transmitted.
Frequently asked questions
Why does UTF-8 byte size differ from character count?
ASCII characters (A-Z, numbers, basic punctuation) use 1 byte each in UTF-8. However, characters from other alphabets, accented letters, symbols, and emojis consume 2, 3, or 4 bytes each. The analyzer uses TextEncoder to measure the exact byte weight as sent over HTTP.
How is nesting depth calculated?
Nesting depth measures the deepest hierarchy of nested objects and arrays from the root level. A flat object has a depth of 1, an object containing an inner object has a depth of 2, and so forth.
Can this tool analyze invalid JSON?
Raw text metrics (byte size, character count, line count) are calculated for any text. If the JSON is invalid, an actionable syntax error banner is displayed and structural AST metrics are paused until valid JSON is provided.
How can I switch units between Bytes, KB, and MB?
Use the Display Units toggle buttons (Auto, Bytes, KB, MB) in the toolbar to switch between human-friendly units or exact byte counts.
Is my JSON uploaded to any external server?
No. All parsing, byte measurement, and AST tree analysis run exclusively in your browser. Nothing is uploaded, logged, or shared.