Главная Text to Hex

Text to Hex

Convert text to hexadecimal code, or decode hex back to text — 100% in your browser.

Input

Output

What is hexadecimal encoding?

Hexadecimal (or hex) is a base-16 number system that uses 16 symbols: the digits 0–9 and the letters A–F. Each byte of data (8 bits) can be represented as exactly two hex digits, making hex a compact and readable way to represent binary data. When text is encoded to hex, each byte of the text's UTF-8 representation is written as a two-character hex pair.

Hex encoding is widely used in computing for representing binary data, color values, memory addresses, cryptographic hashes, and more. Unlike base64, hex is human-readable and easy to eyeball — you can see exactly which bytes are present. This tool encodes each UTF-8 byte as a two-digit uppercase hex value separated by spaces, and can also decode hex back to text.

How hex encoding works

This tool works on the UTF-8 byte level. When encoding, the input string is converted to UTF-8 bytes using the browser's built-in TextEncoder API, and each byte is converted to a two-digit hex string using byte.toString(16).padStart(2, "0"). The leading zeros are essential — without them, a byte like 5 would become "5" instead of "05", which would break decoding. The hex pairs are separated by spaces for readability.

When decoding, the tool first strips any non-hex characters (spaces, newlines, 0x prefixes, etc.) from the input, then parses pairs of hex digits back into bytes using parseInt(pair, 16), and finally decodes the byte array back to text using TextDecoder. This means you can paste hex in almost any format — with or without spaces, with 0x prefixes, or wrapped across multiple lines — and it will decode correctly.

When to use text to hex

Converting text to hex is useful in a range of practical situations:

  • Debugging and inspection. Examine the raw bytes of a string to troubleshoot encoding issues or verify byte-level data.
  • Data representation. Represent binary or text data in a format that is safe for transmission and storage.
  • Cryptography. Compare hash values, inspect key material, or work with encoded payloads.
  • Web development. Work with URL-encoded data, color values, or byte-level protocols.
  • Education. Learn how characters are represented at the byte level in UTF-8.

Hex encoding is not encryption — anyone can decode it — so never use it to protect secrets.

How to convert text to hex

Converting text to hex with this tool takes a second and happens entirely in your browser. Follow these three steps:

  1. Choose a mode. Select "Text → Hex" to encode text, or "Hex → Text" to decode hex, using the radio buttons.
  2. Paste your input. Type or paste your text (encode mode) or hex string (decode mode) in the input box.
  3. Click "Convert" and copy. The result appears in the output box. Click "Copy" to copy it, or "Clear" to start over.

Because the conversion runs locally with JavaScript, your input never leaves the browser. This makes the tool suitable for confidential strings.

Tips for working with hex

When encoding, the output uses space-separated uppercase hex pairs (e.g., "48 69"), which is the most common and readable format. If you need lowercase hex or a different separator, you can adjust the output after copying. When decoding, the tool is flexible: it accepts hex with or without spaces, with 0x prefixes, lowercase or uppercase, and even multi-line input.

Keep in mind that each UTF-8 byte becomes exactly two hex digits. An ASCII character like "A" is one byte ("41"), but a Chinese character is three bytes (six hex digits) and many emoji are four bytes (eight hex digits). This is why the hex output for non-English text is much longer than for English text. Finally, remember that hex encoding is reversible but not secure — it provides no confidentiality.

Is this text to hex converter free?

Yes, completely free with no sign-up, no watermarks and no limits beyond your device's memory.

Does it support Chinese, Japanese and emoji?

Yes. The tool works on the UTF-8 byte level, so Chinese characters, Japanese kana and kanji, emoji and any other Unicode characters are correctly encoded. Each UTF-8 byte becomes a two-digit hex pair.

Why does decoding fail on my hex string?

The most common reason is an odd number of hex digits — hex must come in pairs. The tool strips non-hex characters automatically, so spaces and prefixes won't cause errors, but a missing or extra digit will.

Is my text uploaded?

No. All conversion is local. Your text never leaves your browser, so it is safe to paste confidential strings.