Home › Developer Tools › UTF-8 Encoder / Decoder

UTF-8 Encoder / Decoder

Type text to see its exact UTF-8 bytes as hex, decimal, binary, octal, \x escapes or percent encoding, or paste bytes to decode them back to text. The code point table shows how every character is split into 1 to 4 bytes.

Last updated:

Samples:
Code point table

110 length marker · 10 continuation marker · 01001 code point bits

CharCode pointBytesUTF-8 hexDecimalBit pattern
Advertisement
Advertisement

How to use the UTF-8 Encoder / Decoder

  1. Choose a mode: Encode turns text into UTF-8 bytes, Decode turns bytes back into text.
  2. Pick the byte format, for example spaced hex, decimal, binary, \x escapes or percent encoding.
  3. Type or paste your text or bytes. The result updates instantly as you type.
  4. Check the code point table to see each character's U+ code point and how its bits are spread over the bytes.
  5. Copy or download the result, or press Swap to reverse the conversion.

How UTF-8 encodes a character

UTF-8 writes each Unicode code point with 1 to 4 bytes. The first byte says how many bytes follow, and every following byte starts with the bits 10. The code point's bits (x) are filled in from left to right:

Code point rangeBytesBit patternExample
U+0000 to U+007F10xxxxxxxA = 41
U+0080 to U+07FF2110xxxxx 10xxxxxxé (U+00E9) = C3 A9
U+0800 to U+FFFF31110xxxx 10xxxxxx 10xxxxxx€ (U+20AC) = E2 82 AC
U+10000 to U+10FFFF411110xxx 10xxxxxx 10xxxxxx 10xxxxxx😀 (U+1F600) = F0 9F 98 80

Worked example for €: U+20AC is 0010 0000 1010 1100 in binary. Split into 4 + 6 + 6 bits: 0010, 000010, 101100. Add the markers: 11100010, 10000010, 10101100 = E2 82 AC.

Invalid UTF-8 and what the decoder reports

  • Unexpected continuation byte (80 to BF with no lead byte): often a sign that text was cut in the middle of a character.
  • Sequence cut off at the end: a lead byte such as E2 or F0 without enough following bytes, typical of truncated buffers.
  • Overlong encoding: a character encoded with more bytes than needed, for example C0 AF for "/". These are forbidden because they were used to bypass security filters.
  • Surrogates and values above U+10FFFF: ED A0 80 to ED BF BF (U+D800 to U+DFFF) and anything above F4 8F BF BF are not valid UTF-8.

Each invalid sequence becomes one replacement character U+FFFD (EF BF BD), following the same rules as browsers (the WHATWG Encoding Standard).

Common mojibake patterns

When UTF-8 bytes are read as Windows-1252 or Latin-1 you get typical garbage: é instead of é (C3 A9), € instead of € (E2 82 AC) and 😀 instead of 😀. Paste the garbled characters into Encode to see which bytes they are, or convert between encodings with a text encoding converter.

Frequently asked questions

What is UTF-8?

UTF-8 is the dominant text encoding on the web. It stores every Unicode code point as 1 to 4 bytes: ASCII characters (U+0000 to U+007F) use one byte, most Latin, Greek, Cyrillic, Hebrew and Arabic letters use two, most other scripts including Chinese, Japanese and Korean use three, and emoji and other characters above U+FFFF use four.

How do I convert text to UTF-8 hex?

Type or paste the text in Encode mode with the Hex format selected. Each byte appears as two hex digits, for example é becomes C3 A9 and € becomes E2 82 AC. Choose No separator for a compact string such as C3A9, or the \x format for C, Python and shell byte strings.

How do I decode UTF-8 bytes to text?

Switch to Decode and paste the bytes. The tool detects hex (with or without spaces or 0x), decimal, binary, octal, \x escapes and %XX percent encoding automatically. You can also force a format if the input is ambiguous, for example 10 20 30 could be hex or decimal.

Why do I see the replacement character �?

The byte sequence is not valid UTF-8 at that point, for example a continuation byte without a lead byte, a sequence cut off at the end, an overlong encoding or a byte such as C0, C1 or F5 to FF that never appears in UTF-8. The decoder replaces each bad sequence with U+FFFD and lists its byte offset so you can find the problem.

What is the UTF-8 BOM?

The byte order mark EF BB BF is an optional signature at the start of a UTF-8 file. UTF-8 has no byte order, so it is only a hint that the file is UTF-8. Many tools, JSON parsers and shell scripts dislike it, so it is usually best left out. The decoder strips a leading BOM and tells you it was there.

How many bytes does a character take in UTF-8?

It depends on the code point: U+0000 to U+007F take 1 byte, U+0080 to U+07FF take 2, U+0800 to U+FFFF take 3, and U+10000 to U+10FFFF take 4. An emoji such as 👍🏽 can be several code points, so it may take 8 or more bytes even though it looks like one character.

Is my text sent to a server?

No. Encoding and decoding use your browser's built-in TextEncoder and TextDecoder, so nothing you type or paste leaves your device.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Unicode Escape / UnescapeConvert text to \uXXXX, \u{...}, \x, &#...; or CSS escapes and decode them back.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.Binary TranslatorConvert text to binary, hex, octal and back.Password GeneratorCreate strong passwords and passphrases.Hash GeneratorGenerate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.MD5 Hash GeneratorGenerate MD5 hashes of text, lines or files and verify checksums.SHA-256 Hash GeneratorSHA-256 and HMAC-SHA256 hashes of text, lines or files, in hex or Base64.Base64 Encoder DecoderEncode or decode Base64 text and files, and make data URIs.URL Encoder DecoderPercent-encode or decode URLs, query strings and form data.HTML Entity Encoder / DecoderEscape and unescape HTML entities, named or numeric.Bcrypt Hash Generator & CheckerCreate bcrypt password hashes and check a password against a hash.HMAC GeneratorGenerate and verify HMAC signatures with SHA-256, SHA-512, SHA-1 or MD5.CRC32 Checksum CalculatorCalculate CRC-32, CRC-32C, CRC-16 and Adler-32 checksums of text or large files.JWT DecoderDecode JSON Web Tokens, read the claims and expiry, and verify HS256 signatures.JWT GeneratorCreate and sign HS256, HS384 or HS512 JSON Web Tokens in your browser and verify them.Password Strength CheckerSee how strong a password really is, how long it takes to crack and how to improve it.Caesar CipherEncode and decode Caesar shift ciphers and crack unknown shifts with a ranked brute force.Vigenère CipherEncrypt and decrypt Vigenère and Autokey ciphers, and crack unknown keys with frequency analysis.Atbash CipherEncode and decode Atbash ciphers (A↔Z, B↔Y) in Latin or Hebrew, with a live letter mapping table.ASCII TableFull ASCII code chart 0–255 in decimal, hex, octal, binary and HTML, with search and copy.Unicode Character LookupFind Unicode characters by name or code point and copy them with UTF-8, HTML and code escapes.Punycode ConverterConvert international domain names, emails and URLs between Unicode and xn-- Punycode, in bulk.JSON Escape / UnescapeEscape text for a JSON string, unescape \n and \" back to text, or stringify a whole object.Binary to HexConvert binary to hex instantly with steps and signed mode.Hex to BinaryConvert hex to binary instantly with steps and signed mode.Binary CalculatorAdd, subtract, multiply, divide, AND, OR, XOR and shift binary numbers with decimal values.Hex CalculatorHexadecimal + − × ÷ and AND, OR, XOR, NOT, shifts with decimal and binary equivalents.Base32 Encoder / DecoderEncode and decode Base32 (RFC 4648), Base32hex, Crockford and z-base-32 from text, hex or files.Base58 Encoder / DecoderEncode and decode Base58 and Base58Check (Bitcoin alphabet) from text or hex, with checksum verification.File Hash CheckerGet MD5, SHA-1, SHA-256 and SHA-512 checksums of files and verify them against a hash.TOTP GeneratorGenerate 2FA one-time codes from a secret key, create otpauth QR codes and verify codes.RSA Key GeneratorGenerate 2048, 3072 or 4096-bit RSA key pairs as PEM, PKCS#1, JWK or OpenSSH, locally.SSL Certificate DecoderDecode PEM SSL/X.509 certificates: subject, issuer, expiry, SANs, key and fingerprints.Text Encryption ToolEncrypt and decrypt text with a password using AES-256-GCM, entirely in your browser.Argon2 Hash GeneratorHash passwords with Argon2id, Argon2i or Argon2d and verify them against an encoded hash.Base64 to PDFDecode a Base64 string to a PDF with preview and download, or encode a PDF to Base64.Bitwise CalculatorCalculate AND, OR, XOR, NOT and bit shifts at 8–64 bits with a bit grid and all bases.Hex Opacity CalculatorConvert opacity percent to a 2-digit HEX alpha code and full #RRGGBBAA color, with a 0-100% table.Playfair CipherEncrypt and decrypt Playfair ciphers from a keyword, with the 5x5 key square and every digraph step.Pwned Password CheckerCheck if a password appeared in data breaches; only 5 characters of its SHA-1 hash are sent.RSA Encryption ToolEncrypt text with an RSA public key and decrypt it with the private key using RSA-OAEP in your browser.SAML DecoderDecode SAMLRequest and SAMLResponse messages to readable XML, attributes and validity times.SSL Certificate ConverterConvert SSL certificates and keys between PEM, DER, PFX/P12 and P7B in your browser.Checksum CalculatorCompute 8-bit sum, two's complement LRC, XOR/BCC, NMEA, Fletcher and Internet checksums of bytes.PBKDF2 Hash GeneratorDerive PBKDF2 keys from a password, salt and iteration count with SHA-1, SHA-256 or SHA-512.Protobuf DecoderDecode raw Protocol Buffers hex or Base64 without a schema, or add a .proto for field names.XML Escape / UnescapeEscape & < > " ' for XML text and attributes, unescape entities back, or wrap text in CDATA.Binary Search Tree VisualizerInsert, delete and find in BST, AVL and red-black trees with animated rotations and traversals.CSR GeneratorCreate a certificate signing request (CSR) and private key with SANs, RSA or ECDSA, in your browser.MongoDB ObjectId to TimestampDecode a MongoDB ObjectId to its creation date, or build ObjectIds from dates for range queries.PGP Encrypt / DecryptEncrypt, decrypt, sign and verify PGP messages with your armored keys, entirely offline.PGP Key GeneratorGenerate an OpenPGP key pair (Curve25519, NIST ECC or RSA) with passphrase and expiry, offline.Quoted-Printable Encoder / DecoderEncode or decode quoted-printable email text (MIME) with UTF-8 and 76-character soft line breaks.Self-Signed Certificate GeneratorCreate a self-signed SSL certificate and key for localhost or dev servers, as PEM or PFX.SHA-1 Hash GeneratorSHA-1 and HMAC-SHA1 of text or files in hex or Base64, plus Git blob hashes and verify.SHA-512 Hash GeneratorSHA-512 and SHA-384 hashes of text or files in hex or Base64, HMAC and hash verification.SRI Hash GeneratorCreate Subresource Integrity hashes (sha256/384/512) and ready <script> or <link> tags.SSH Key GeneratorGenerate Ed25519 or RSA SSH key pairs in your browser: OpenSSH public key plus private key.String Escape / UnescapeEscape or unescape strings for JavaScript, Java, C#, Python, C, SQL, regex, CSV and shell.UUID Decoder & ValidatorDecode any UUID: version, variant, v1/v6/v7 timestamp and MAC node, plus bulk validation.Base64 to FileDecode Base64 or a data URI to a downloadable file; detects the real file type and previews it.File Encryption ToolEncrypt and decrypt any file with a password using AES-256-GCM, entirely in your browser.Passphrase GeneratorMake strong, memorable diceware passphrases from a 7,776-word list, with entropy in bits.CSR DecoderDecode a PEM certificate signing request: subject, SANs, key size, signature and CA readiness checks.Enigma Machine SimulatorEncrypt and decrypt with a virtual Enigma I, M3 or M4: rotors, rings, plugboard and lampboard.
See all 65 Encoders, Hashes & Crypto →