Text Byte Size

Calculate how many bytes your text uses in UTF-8 and UTF-16 encoding. Essential for storage and API limits.

Byte Size Calculator

UTF-8
0 B
UTF-16
0 B
Characters
0

Conversion Guide

Conversion

8

UTF-8

1-4 bytes per character

Variable width: ASCII=1 byte, most chars=2-3 bytes, emojis=4 bytes

16

UTF-16

2-4 bytes per character

Most characters=2 bytes, supplementary chars=4 bytes (surrogate pairs)

Step-by-Step Scenario

Example Scenario

Text

Hello

Characters

5

1

UTF-8 Calculation

  • Each ASCII character = 1 byte
  • 5 characters × 1 byte = 5 bytes

Calculate UTF-8 byte size

2

UTF-16 Calculation

  • Each character = 2 bytes
  • 5 characters × 2 bytes = 10 bytes
UTF-8 = 5 bytes, UTF-16 = 10 bytes

Additional Examples

With Emoji

Text: Hello 😀

UTF-8

9 bytes (5 + 4 for emoji)

UTF-16

12 bytes (6 × 2)

International

Text: Café

UTF-8

5 bytes (é = 2 bytes)

UTF-16

8 bytes (4 × 2)

Characteristics of Byte Size

Encoding Dependent

Byte size depends on encoding. UTF-8 is variable-width (1-4 bytes), UTF-16 is mostly 2 bytes per character.

Character Dependent

ASCII characters are 1 byte in UTF-8. International characters and emojis use more bytes (2-4 bytes).

Real-Time Calculation

Calculate byte size instantly as you type. Shows UTF-8, UTF-16, and character count simultaneously.

API Limits

Essential for understanding API payload limits, database storage requirements, and data transmission sizes.

Important Notes

  • UTF-8 is variable-width: ASCII characters (0-127) use 1 byte, most European characters use 2 bytes, Asian characters and emojis use 3-4 bytes.
  • UTF-16 uses 2 bytes for most characters (BMP - Basic Multilingual Plane) and 4 bytes for supplementary characters (surrogate pairs).
  • Character count ≠ byte count. One character (like an emoji) can be 4 bytes in UTF-8 and 4 bytes in UTF-16.
  • For storage optimization, UTF-8 is more efficient for ASCII-heavy text. UTF-16 may be more efficient for Asian languages.
  • API limits are often specified in bytes, not characters. Always check byte size when working with API payload limits.

Frequently Asked Questions

Find answers to common questions about text byte size calculation.