UTF-16 Byte Size Calculator
Calculate the UTF-16 encoded byte size and compare it with UTF-8.
About UTF-16 Byte Size Calculator
UTF-16 uses two bytes for most characters and four for supplementary ones through surrogate pairs. It is more compact than UTF-8 for Asian scripts but wasteful for ASCII-heavy text. Because JavaScript strings are UTF-16, the length property counts code units rather than characters, which is why an emoji reports a length of two.
Formula
UTF-16 Byte Size
UTF-16 bytes = code units × 2, where supplementary characters take two code units
- surrogate pair
- Two code units representing one character beyond the basic plane
- code unit
- A 16-bit unit; a character may need one or two
Worked example
With the default values below, UTF-16 Byte Size Calculator returns Total UTF-16 Size of 1,920. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Basic multilingual plane charactersminimum 0
- 900
- Supplementary plane characters such as emojiminimum 0
- 30
- Share of the text that is ASCIIaccepts 0–100 %
- 70 %
Results
- Total UTF-16 Size
- 1,920 bytes
- UTF-16 Code Units
- 960
- Total Characters
- 930
- Equivalent UTF-8 Size
- 1,425 bytes
- More Compact Encoding
- UTF-8 is more compact for this text
Step by step
- 1Values used
- 2UTF-16 Byte Size
- 3Total UTF-16 Size= 1,920 bytes
- 4UTF-16 Code Units= 960
- 5Total Characters= 930
- 6Equivalent UTF-8 Size= 1,425 bytes
- 7More Compact Encoding= UTF-8 is more compact for this text
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How is UTF-16 Byte Size calculated?
UTF-16 bytes = code units × 2, where supplementary characters take two code units UTF-16 uses two bytes for most characters and four for supplementary ones through surrogate pairs. It is more compact than UTF-8 for Asian scripts but wasteful for ASCII-heavy text.
Why does UTF-16 Byte Size matter?
Because JavaScript strings are UTF-16, the length property counts code units rather than characters, which is why an emoji reports a length of two.
What values do I need to enter?
This calculator takes 3 inputs: Basic multilingual plane characters, Supplementary plane characters such as emoji, Share of the text that is ASCII. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
