Skip to content
BCBinary Code Translator
Menu

UTF-8 byte tool

Text ↔ Hex Converter

Encode any Unicode text as UTF-8 hexadecimal bytes, or decode a hexadecimal byte sequence back into readable text.

All conversion happens in your browser. Your text and byte data are not uploaded.

Hexadecimal bytes

No result yet

UTF-8 bytes

No result yet

Unicode characters

No result yet

What this text and hex converter does

Text and hexadecimal are two views of the same underlying bytes. People read characters, while protocols, debuggers, file formats, and low-level documentation often show those bytes as pairs of hexadecimal digits. This tool bridges the two views without treating text as old-fashioned ASCII. It first encodes text with UTF-8, the dominant encoding used by the web, then prints every byte from 00 through FF. In the reverse direction it parses the byte sequence and decodes it with strict UTF-8 validation.

That distinction matters for anything beyond basic English. The letter é, a Chinese character, and an emoji do not fit into one ASCII byte. UTF-8 represents them with two, three, or four bytes. A correct converter must preserve those sequences rather than convert JavaScript character codes directly. The output therefore matches what you would see in a network payload, a UTF-8 file, a database field, or a programming language byte array.

How to use the converter

Choose a direction, enter the source value, and calculate. The settings affect only text-to-hex output; decoding accepts several common separator styles.

  1. Select Text to hexadecimal when you want the UTF-8 bytes for readable text, or Hexadecimal to text when you already have bytes.
  2. Paste the input. For text, any Unicode character is allowed. For hex, use two digits per byte and optionally separate bytes with spaces, colons, commas, semicolons, hyphens, or underscores.
  3. For encoding, choose uppercase or lowercase digits and decide whether bytes should be compact, space-separated, or colon-separated.
  4. Press Calculate. Review the decoded text or encoded bytes together with the byte and character counts.
  5. Copy the result into source code, documentation, a packet analyzer, or another local tool. When decoding untrusted data, keep the original bytes so you can compare them.

UTF-8 text and hex examples

These cases show why UTF-8 byte conversion is different from simply looking up a character number.

Input Output Explanation
Hello 48 65 6C 6C 6F Plain Latin letters use one UTF-8 byte each, so the byte count equals the character count.
café 63 61 66 C3 A9 The accented é is encoded as the two-byte sequence C3 A9.
你好 E4 BD A0 E5 A5 BD Each Chinese character uses three UTF-8 bytes, producing six bytes in total.
👋 F0 9F 91 8B This emoji is represented by four UTF-8 bytes even though it appears as one symbol.
00 41 0A NUL, A, newline Decoded bytes may include control characters that are not visibly rendered in the output area.
C3 28 Error C3 begins a multibyte sequence, but 28 is not a valid continuation byte, so strict decoding rejects it.

Accepted input formats

Text mode accepts the full JavaScript string model and encodes it with the browser TextEncoder. Line breaks, tabs, combining marks, emoji, and scripts from different languages are preserved. Character count is based on Unicode code points, while byte count reflects the actual UTF-8 payload. Some visible grapheme clusters, such as a family emoji or a letter plus combining accent, can still contain more than one code point.

Hex mode is byte-oriented. A byte must ultimately contain exactly two hexadecimal digits. You may paste a compact sequence such as 4869, add a single 0x prefix, write 0x48 0x69, or use common separators. Whitespace and supported separators are removed before validation. Odd-length input is rejected because a trailing half-byte has no unambiguous meaning.

  • Allowed hexadecimal digits are 0-9 and A-F, in either letter case.
  • Prefixes are optional; repeated 0x prefixes before individual bytes are accepted.
  • The decoder rejects malformed UTF-8 instead of silently inserting replacement characters.
  • An empty input produces an empty output and does not contact any server.

How the conversion works

For text-to-hex conversion, the browser TextEncoder turns the string into a Uint8Array using UTF-8. Each byte is converted to base 16, padded to two digits, and joined with the selected separator. Because the algorithm operates on bytes, values from 0 through 15 are written with a leading zero, for example a newline byte becomes 0A rather than A.

For hex-to-text conversion, the tool removes recognized formatting characters, verifies that the remaining sequence contains only hexadecimal digits, and checks that the length is even. It then parses every pair into one byte. TextDecoder runs in fatal UTF-8 mode, which means invalid leading bytes, missing continuation bytes, overlong encodings, and isolated continuation bytes produce an error instead of a guessed string.

The converter does not infer UTF-16, Latin-1, GBK, or another legacy encoding. The same byte sequence can represent different text under different encodings, so automatically guessing would be unreliable. This page intentionally uses UTF-8 and states that choice clearly.

Practical uses

Hexadecimal byte views are useful whenever a system stores or transports text but exposes the raw representation.

Debug API payloads

Compare a copied request body with the bytes documented by an API, especially when spaces, line breaks, non-ASCII names, or emoji behave differently between clients.

Inspect file signatures and fields

Read UTF-8 portions of a binary file, configuration export, or database dump without sending the material to an external decoder.

Prepare programming literals

Generate byte sequences for tests, firmware fixtures, protocol examples, SQL hex literals, or arrays in languages that expect explicit byte values.

Teach Unicode and encoding

Demonstrate that a visible character is not always one byte, and compare character count, code-point count, and UTF-8 byte count with concrete examples.

Common mistakes and edge cases

Most failures come from confusing characters, code points, and bytes, or from pasting a sequence produced under another encoding.

Odd number of hex digits

A byte requires two digits. Add the missing leading zero or recover the missing nibble from the original source instead of guessing.

Wrong character encoding

Bytes created as UTF-16, Windows-1252, Latin-1, or GBK may be valid data but will not necessarily decode as UTF-8. Use a converter that explicitly supports the original encoding.

Invisible control bytes

NUL, tab, carriage return, and newline can decode correctly while remaining invisible or changing layout. Check the original hex when the displayed result looks unexpectedly empty.

Look-alike Unicode text

Visually identical strings can use different normalization forms or combining marks and therefore produce different bytes. Byte equality is stricter than visual equality.

Choose the tool based on the representation you actually need rather than the appearance of the output.

Text to binary

A text-to-binary converter displays the same UTF-8 bytes as groups of eight 0/1 digits. Hex is shorter and easier to scan, while binary exposes individual bits.

ASCII table

An ASCII table documents the first 128 code points. It is useful for basic Latin control and printable characters but does not describe full UTF-8 sequences.

Base64 encoder

Base64 maps arbitrary bytes into printable text for transport. Hex is more verbose but preserves obvious byte boundaries and is easier to inspect manually.

Number base converter

A base converter treats input as one integer. This tool treats every two hex digits as a byte sequence, so leading zeros and byte order remain meaningful.

Frequently asked questions

Does one character always become two hex digits?

No. Two hex digits represent one byte, not one character. ASCII characters use one UTF-8 byte, while many accented letters use two bytes, many Asian characters use three, and many emoji use four.

Can I decode hex without spaces?

Yes. Compact input such as 48656C6C6F is accepted as long as the total number of digits is even. Spaces, colons, commas, semicolons, hyphens, underscores, and 0x prefixes are also accepted.

Why does valid hex sometimes produce a UTF-8 error?

A sequence can be syntactically valid hexadecimal yet still violate UTF-8 rules. For example, a multibyte lead byte must be followed by specific continuation bytes. Strict validation prevents corrupted text from being silently changed.

Does the tool preserve emoji and non-Latin scripts?

Yes. It uses the browser UTF-8 encoder and decoder, so valid Unicode text, including emoji and multilingual scripts, round-trips through the corresponding bytes.

Is this the same as converting a hexadecimal number to decimal?

No. Here, hex is interpreted as ordered bytes that encode text. A numeric base converter interprets the entire sequence as one integer and may discard leading zero bytes.

Is my text sent anywhere?

No. Encoding, parsing, validation, and decoding are performed locally in the browser. The page does not call an external service with your input.

Related tools

View all tools

Cookie Preferences

Manage your cookie preferences. Necessary cookies cannot be disabled.

Necessary

Required

Required for language selection, privacy choices, and basic site functionality.

Cookies: NEXT_LOCALE

Analytics

Optional analytics cookies help us understand traffic and improve the website.

Cookies: _ga, _gid, _gat, _clck, _clsk

Advertising

Optional advertising cookies may be used to show relevant ads and measure performance.

Cookies: __gads, _gcl_au, IDE