Analyze text encoding characteristics and compatibility

Analyze which Unicode ranges pasted text uses and compare its UTF-8, UTF-16, and UTF-32 storage sizes.

freeworks offlinenothing uploaded
ToolCharset Detector
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The browser has already decoded the paste into a JavaScript string, so code points are grouped as ASCII, Latin-1, other BMP, or supplementary while TextEncoder measures UTF-8 bytes. UTF-16 is estimated as two bytes per code unit and UTF-32 as four bytes per code point; this cannot recover the original byte encoding.

  • The four ranges expose minimum repertoire requirements rather than claiming to identify a source charset.
  • Only leading U+FEFF is reported as a retained Unicode signature; decoded U+FFFE is not labelled a reversed BOM.

Worked example

Detect ASCII
Analyze a pure ASCII string for encoding compatibility
Input
											Hello, World!
										
Output
												=== Encoding Analysis ===
BOM: None detected

=== Character Distribution ===
Total code points: 13
ASCII (U+0000-U+007F): 13 (100.0%)
Latin-1 (U+0080-U+00FF): 0 (0.0%)
BMP (U+0100-U+FFFF): 0 (0.0%)
Supplementary (U+10000+): 0 (0.0%)
Whitespace characters: 1

=== Encoding Compatibility ===
Compatible with: ASCII, UTF-8, Latin-1, UTF-16, UTF-32
Recommended encoding: ASCII or UTF-8

=== Size Estimates ===
UTF-8: 13 bytes
UTF-16: 26 bytes
UTF-32: 52 bytes
											

When to use this

Developers check seven-bit compatibility, database migrations compare storage estimates, and import investigations locate a retained leading U+FEFF.

Edge cases

  • Pure ASCII is also valid UTF-8 and ISO-8859-1, so pasted ASCII cannot reveal which compatible encoding supplied it.
  • € requires Unicode here even though Windows-1252 assigns a byte to it; that original byte history disappeared during decoding.
  • 😀 is one supplementary code point, four UTF-8 bytes, two UTF-16 units, and four estimated UTF-32 bytes.

References