Text Size Calculator
Compare text encodings and payload sizes in your browser.
How to use the calculator
- Paste text or inspect a local text file. The editor starts empty and keeps the original line endings.
- Choose an encoding, line-ending transformation and optional BOM. Read exact bytes and compare the serialized representations.
- Set an optional byte budget for the representation your API expects. Copy the original text, summary or complete encoded output explicitly.
- Read the highlighted size in automatically selected bytes, KB, MB or GB (TB/PB for larger values). Exact bytes remain below and beside other large results. Readable sizes are rounded; budget checks always use exact bytes.
Features
- Compares UTF-8, UTF-16 and UTF-32 sizes
- Shows exact bytes, line-ending and BOM effects
- Checks an optional byte budget
- Shows encoded output that you can copy explicitly
- Inspects how individual characters contribute to size
Use cases
- Check an API payload before sending it
- Compare encodings for a local text file
- Choose line endings and a BOM for an export
- Compare Base64 and URL-encoded text sizes
Understanding bytes, encodings and payloads
A byte is eight bits; a visible character can contain multiple Unicode code points. 😀 is one grapheme, one code point and two UTF-16 units: 4 bytes in UTF-8, UTF-16 and UTF-32. Combining marks and ZWJ emoji sequences make character counts differ from byte counts.
UTF-8 uses 1–4 bytes per Unicode scalar; UTF-16 uses 2 or 4 and UTF-32 uses 4. A takes 1/2/4 bytes respectively. Cyrillic, Arabic, Chinese and emoji are valid text, even when they need more bytes. These are encoded content sizes, not JavaScript heap use or allocated disk space.
No normalization, trimming or invisible-character removal occurs. Composed é uses 2 UTF-8 bytes; e + U+0301 uses 3. Both are usually one grapheme. The original source is preserved: only the selected line-ending transformation creates effective text for results.
An added BOM costs 3 bytes in UTF-8, 2 in UTF-16 or 4 in UTF-32, even for empty text. A literal leading U+FEFF remains content. LF uses one ASCII byte; CRLF uses two. Conversion handles CRLF together, then lone CR/LF, leaving NEL, U+2028 and U+2029 unchanged.
For A space B, UTF-8 is 3 bytes, URL output A%20B is 5, and form value A+B is 3. A followed by CRLF then B is 4 UTF-8 bytes, or 3 after LF conversion; its preserved JSON string is 8 bytes. JSON includes outer quotes and escapes: it serializes the input as one string rather than minifying a JSON document.
Base64 is an encoding, not compression or encryption. Standard padded output has 4 × ceil(byteLength / 3) ASCII bytes, approaching one-third overhead for long input. UTF-8 A becomes QQ== (4 bytes). Empty input without a BOM produces empty Base64; an empty JSON string still takes 2 bytes.
File.size is the immutable original byte count, including its signature. File import supports UTF-8 and UTF-16LE/BE with strict decoding. A recognized BOM chooses the decoder and is removed exactly once; additional U+FEFF content is retained. Without a signature UTF-8 is assumed, not reliably detected. Re-encoding can differ because of encoding, line endings, BOM policy or edits.
For an API field limit, check whether the service counts raw text, a JSON string or URL/form data. This calculator excludes property names, object wrappers, field names, equals signs and HTTP headers. A zero budget accepts only an empty representation; equality fits exactly. Database and platform rules may differ. Use related tools for word counts, social limits and SMS segments.
Local processing and scope
Processing happens locally. This tool does not upload entered text or files. The site’s shared analytics and advertising may make network requests.
Frequently asked questions
Sources
Sources reviewed: 2026-09-13. Algorithms follow these specifications; the date is not an accuracy guarantee.
Related tools
JSON to YAML
Convert JSON to YAML locally while preserving number text and quoted strings; copy or download the complete result.
Open tool — JSON to YAMLYAML to JSON
Convert one YAML document locally to JSON with exact number text and bounded aliases, then copy or download the complete result.
Open tool — YAML to JSONHTML to Markdown
Convert pasted or local HTML into Markdown, review conversion notes, and copy or download the result.
Open tool — HTML to MarkdownJavaScript Regex Tester
Test a JavaScript pattern locally and inspect matches, captures, and UTF-16 positions.
Open tool — JavaScript Regex TesterMarkdown to HTML
Convert a Markdown draft to an HTML fragment, inspect the source and inert preview, then copy or download it.
Open tool — Markdown to HTMLText Sorter
Sort lines alphabetically by a chosen language or by Unicode code point, keeping duplicates, blank rows and complete line contents.
Open tool — Text SorterRemove Duplicate Lines
Keep the first copy of each exact text line, preserving order, significant spaces and blank rows, then copy or download the result.
Open tool — Remove Duplicate LinesText Diff Checker
Compare two drafts locally, with exact whole-line changes, visible whitespace rules and clear final-newline handling.
Open tool — Text Diff CheckerCase Converter
Convert text to uppercase, lowercase, capitalized words or sentence case with explicit letter rules.
Open tool — Case ConverterHTML Entity Encoder/Decoder
Encode or decode literal HTML references with explicit context, Unicode options and LF output, without parsing or rendering markup.
Open tool — HTML Entity Encoder/DecoderMarkdown Table Generator
Edit a small literal-text table, set alignment and copy GFM Markdown or import tab-separated text.
Open tool — Markdown Table GeneratorQuery String Parser & Builder
Edit ordered URL parameters, retain repeated names and copy a normalized query or HTTP(S) URL.
Open tool — Query String Parser & BuilderURL Encoder & Decoder
Convert a UTF-8 URL component or form value with explicit space and plus rules, then copy or download the result.
Open tool — URL Encoder & DecoderBase64 Encoder & Decoder
Encode UTF-8 text as standard or URL-safe Base64, or decode either format with clear errors and complete text output.
Open tool — Base64 Encoder & DecoderXML Formatter
Check namespace-aware XML 1.0, format or compact locally, and copy or download UTF-8 output.
Open tool — XML FormatterJSON Formatter & Validator
Check JSON syntax, format or minify locally, and copy or download output while preserving original data tokens.
Open tool — JSON Formatter & ValidatorSMS Character Counter & Segment Calculator
See how your message is encoded, where its segments end and what it may cost. Your text stays in your browser.
Open tool — SMS Character Counter & Segment CalculatorSocial Media Character Counter
Check platform-specific limits and split posts without losing text.
Open tool — Social Media Character CounterCharacter Counter
Count characters, words, sentences and paragraphs. Check word density, reading time and UTF-8 size, all in your browser.
Open tool — Character CounterPDF Text Cleaner
Fix line breaks and spacing in text copied from a PDF. Preserve your original and review ambiguous hyphens before copying the cleaned text.
Open tool — PDF Text CleanerFancy Text Converter
Convert supported fancy Unicode letters to normal text locally. Keep case, accents, emoji and your original text.
Open tool — Fancy Text ConverterGarbled Text Fixer
Fix garbled text and repair broken accents with a browser-based mojibake fixer. Review each possible UTF-8 reversal before applying it.
Open tool — Garbled Text FixerGmail Clipping Checker
Measure email HTML bytes in UTF-8, compare them with an advisory 102,000-byte Gmail reference, and inspect size contributors locally.
Open tool — Gmail Clipping Checker