A byte counter measures the size of your text in different encoding formats including UTF-8, UTF-16, and ASCII. Whether you are a developer checking API payload sizes, a database administrator verifying field limits, or a systems engineer debugging encoding issues, this free online byte counter gives you instant, accurate results. No signup required. Try it now.
Try the Free Byte Counter
How It Works
The tool uses the browser's built-in TextEncoder for accurate UTF-8 counting, calculates UTF-16 as characters x 2, and counts ASCII characters (code points <= 127). Multi-byte characters (accented letters, CJK, emoji) are identified automatically. UTF-8 is variable-width (1-4 bytes), UTF-16 is mostly fixed at 2 bytes, ASCII is 1 byte.
How to Use the Byte Counter — Step by Step
Step 1: Enter your text
Paste or type the text you need to measure — an API payload, database field content, message queue message, or any text where byte size matters. Works with any text length.
Step 2: View encoding sizes
See instant byte counts for UTF-8 (web standard), UTF-16 (JavaScript internal), and ASCII (legacy systems). Also see total characters and multi-byte character count. UTF-8 is the most commonly needed for web APIs.
Step 3: Compare encodings
Notice how UTF-8 grows with non-ASCII characters (2-4 bytes each) while UTF-16 stays at 2 bytes for most characters but uses 4 for emoji/rare chars. This difference matters for storage and transmission.
Step 4: Apply to your system
Use the UTF-8 byte count for API limits, database VARCHAR sizing, message queue limits, or any byte-constrained system. The multi-byte count helps you budget for international content.
Common Use Cases
- API Development: Verify request/response payloads stay within byte limits (e.g., AWS Lambda 6MB, API Gateway 10MB, Cloudflare Workers 128KB) — prevent 413 Payload Too Large errors
- Database Design: Size VARCHAR/TEXT columns correctly for UTF-8 content — especially important for international text where characters use 2-4 bytes each
- Message Queues: Check message sizes for Kafka, RabbitMQ, SQS, or other queue systems with byte limits — oversized messages cause rejection or performance issues
- Storage Planning: Estimate storage costs for text-heavy datasets in cloud storage or databases — byte count directly translates to storage costs
- Encoding Debugging: Identify when text grows unexpectedly due to hidden multi-byte characters — zero-width spaces, BOM markers, or combining characters
- Network Optimization: Minimize payload sizes for mobile APIs or bandwidth-constrained environments — every byte counts on slow connections
Examples
Input: "Hello World"
Output: UTF-8: 11 bytes | UTF-16: 22 bytes | ASCII: 11 bytes | Chars: 11 | Multi-byte: 0
Input: "Café München 🎉"
Output: UTF-8: 19 bytes | UTF-16: 28 bytes | ASCII: 9 bytes | Chars: 14 | Multi-byte: 5 (é, ü, 🎉)
Input: "你好世界" (Chinese)
Output: UTF-8: 12 bytes | UTF-16: 8 bytes | ASCII: 0 bytes | Chars: 4 | Multi-byte: 4 (3 bytes each in UTF-8)
Input: JSON payload with 50 emoji
Output: UTF-8: ~200 bytes extra for emoji alone | Each emoji = 4 bytes UTF-8 | Budget accordingly for social features
Tips & Best Practices
- For APIs: Always use UTF-8 byte count — it's the web standard and what HTTP Content-Length measures
- For databases: MySQL VARCHAR uses characters in utf8mb4, but byte limits still apply to row size (65,535 bytes) — check both character and byte limits
- For emoji: Each emoji is typically 4 bytes in UTF-8 — budget accordingly for social features, multiply emoji count by 4
- For CJK: Chinese/Japanese/Korean characters are 3 bytes each in UTF-8 — plan 3x ASCII storage for Asian language content
- Combine tools: Use with Character Counter and Symbol Counter for complete text profiling — all three give different size perspectives
- For legacy systems: ASCII byte count helps when integrating with systems that only support 7-bit ASCII — identify non-ASCII chars that need encoding
FAQ — Frequently Asked Questions
Q: What is the difference between UTF-8 and UTF-16?
A: UTF-8 uses 1-4 bytes per character (1 byte for ASCII). UTF-16 uses 2 or 4 bytes per character. UTF-8 is more space-efficient for English text.
Q: How are multi-byte characters detected?
A: Characters with Unicode code points above U+007F (127) are multi-byte in UTF-8. This includes accented letters, CJK characters, emoji, and most non-Latin scripts.
Q: What does the ASCII byte count represent?
A: ASCII bytes count only characters in the 0-127 range (basic Latin letters, digits, standard punctuation). Non-ASCII characters are excluded from this count.
Q: Can this help with database field sizing?
A: Yes. Use UTF-8 bytes for VARCHAR sizing in UTF-8 databases. Remember that some databases count characters, not bytes — check your specific database documentation.
Q: Is the tool secure?
A: Yes. All processing happens in your browser. We never see, store, or save your text.
