Byte / Size Calculator

Calculate string byte length in UTF-8, UTF-16, and ASCII. Convert between bytes, KB, MB, GB, TB with SI (decimal) and IEC (binary) units.

Your data never leaves your browser Available via MCP

Enter text and click Calculate

How to Use

  1. Select String Byte Length to measure how many bytes a string takes in different encodings.
  2. Select Size Converter to convert between byte units (KB, MB, GB, etc.).
  3. Click Calculate to see all conversions.
  4. Copy results with the Copy button.

Size Unit Reference

  • SI (decimal): 1 KB = 1,000 B, 1 MB = 1,000 KB, 1 GB = 1,000 MB
  • IEC (binary): 1 KiB = 1,024 B, 1 MiB = 1,024 KiB, 1 GiB = 1,024 MiB

Storage manufacturers use SI units (a "500 GB" drive is 500,000,000,000 bytes). Operating systems traditionally use binary units but label them as "GB" — which is why your "500 GB" drive shows as ~465 GB in your OS.

Common Size Limits

  • Cookie — 4 KB per cookie, ~80 cookies per domain
  • localStorage — typically 5-10 MB per origin
  • HTTP headers — commonly 8-16 KB total
  • URL length — 2,048 characters in most browsers
  • POST body — typically 1-10 MB default in web servers

Related Tools

Encode data to Base64 with the Base64 Encoder. Count words and characters with the Word Counter. Convert number bases with the Number Base Converter. Look up MIME types with the MIME Type Lookup. Calculate durations with the Duration Calculator.

Frequently Asked Questions

What is the difference between KB and KiB?
KB (kilobyte) uses decimal (SI) units: 1 KB = 1,000 bytes. KiB (kibibyte) uses binary (IEC) units: 1 KiB = 1,024 bytes. The difference matters at scale — 1 TB is 1,000,000,000,000 bytes while 1 TiB is 1,099,511,627,776 bytes, a 10% difference.
Why do UTF-8 and UTF-16 give different byte counts?
UTF-8 uses 1 byte for ASCII characters and 2-4 bytes for non-ASCII characters. UTF-16 uses 2 bytes for most characters and 4 bytes for rare supplementary characters. For English text, UTF-8 is smaller. For CJK text, UTF-16 can be smaller.
How is string byte length useful?
Knowing exact byte length is essential for API payload limits, database column sizes, HTTP header limits, cookie size restrictions (4KB max), localStorage limits (5-10MB), and calculating bandwidth usage.
Is my data safe?
Yes. All calculations happen entirely in your browser. No data is sent to any server.

Use this tool from AI agents. The CodeTidy MCP Server lets Claude, Cursor, and other AI agents use this tool and 46 others directly. One command: npx @codetidy/mcp

Drop file to load