Text to Hex Converter

Quick answer

The text to hex converter shows the hexadecimal bytes of any text in UTF-8, UTF-16 (with or without byte order mark) or Windows-1252, separated by spaces, commas or a custom separator, plus the same bytes in binary and decimal. It decodes hex back to text too.

Result
48 65 6C 6C 6F
Same bytes in binary
01001000 01100101 01101100 01101100 01101111
Bytes in decimal
72 101 108 108 111
Number of bytes
5
Number of bits
40
Number of characters
5
Character by character
Char Code point Bytes (hex) ─────────────────────────────── H U+0048 48 e U+0065 65 l U+006C 6C l U+006C 6C o U+006F 6F

Hexadecimal is the programmer’s shorthand for bytes. Every byte (8 bits) is exactly two hex digits, so the 8-bit pattern 01001000 becomes the far shorter 48. That is why hex dumps, URL encoding (%20), colour codes, escape sequences (x41) and network traces all use base 16.

Converting text to hex is a two-step process: the character encoding first turns each character into bytes, and each byte is then written in base 16. For English letters the bytes are plain ASCII: “Hello” is 48 65 6C 6C 6F in every common encoding. Beyond ASCII the choice matters: “ñ” is C3 B1 in UTF-8 but F1 in Windows-1252, and in UTF-16 every character takes at least two bytes, optionally preceded by the byte order mark FE FF.

Choose the encoding your program or file uses, pick a separator that suits your code (none for a compact string, comma and space for an array) and copy the result. Switch the direction to decode a hex string back into text.

How to use the Text to Hex Converter

  1. Direction
  2. Text
  3. Character encoding
  4. Separator between bytes
  5. Custom separator

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

The text is encoded into bytes with the selected character set and each byte is written as two upper-case hexadecimal digits. The table lists every character, its Unicode code point and its bytes, which makes multi-byte characters easy to spot.

Worked example

Convert Hello. The code points are 72, 101, 108, 108, 111. Dividing by 16: 72 = 4 × 16 + 8 → 48; 101 = 6 × 16 + 5 → 65; 108 = 6 × 16 + 12 → 6C; 111 = 6 × 16 + 15 → 6F. Result: 48 65 6C 6C 6F. With UTF-16 and a BOM the same word becomes FE FF 00 48 00 65 00 6C 00 6C 00 6F, which is 12 bytes instead of 5.

Hex digits

Hex 0–9 A B C D E F
Decimal 0–9 10 11 12 13 14 15
Binary 0000–1001 1010 1011 1100 1101 1110 1111

Formula

Character → bytes with the chosen encoding → each byte as two hex digits (00–FF) Byte = 16 × first digit + second digit, with A = 10 … F = 15

Worked example

Inputs: Direction: Text → hex; Text: Hello; Character encoding: UTF-8 (Unicode – recommended); Separator between bytes: Space.
Results: Result = 48 65 6C 6C 6F; Same bytes in binary = 01001000 01100101 01101100 01101100 01101111; Bytes in decimal = 72 101 108 108 111; Number of bytes = 5; Number of bits = 40; Number of characters = 5.

Key terms

Hexadecimal
Base-16 notation using the digits 0–9 and A–F.
Nibble
Four bits, written as one hex digit.
Byte order mark (BOM)
The bytes FE FF or FF FE at the start of UTF-16 text that tell the byte order.
Endianness
Whether the most significant byte of a multi-byte value comes first (big-endian) or last (little-endian).

Frequently asked questions

What is “Hello” in hex?

48 65 6C 6C 6F in UTF-8, ASCII and Windows-1252.

Why are hex bytes always two digits?

One hex digit covers 4 bits (0–15), so two digits cover exactly one byte (00–FF = 0–255).

What is the hex code of a space?

20 (decimal 32). That is why spaces appear as %20 in URLs.

Why does “é” give C3 A9?

UTF-8 needs two bytes for characters from U+0080 to U+07FF. In Windows-1252 é is the single byte E9.

What is the difference between UTF-16LE and UTF-16BE?

The byte order: “A” is 41 00 in little-endian and 00 41 in big-endian. Windows uses little-endian internally.

Are upper- and lower-case hex digits different?

No, 6C and 6c are the same value. This tool prints upper case.

Can I get the result without spaces?

Yes, choose “None” as the separator.

Sources

  1. RFC 3629: UTF-8, a transformation format of ISO 10646
  2. RFC 2781: UTF-16, an encoding of ISO 10646
  3. Unicode Consortium: Windows-1252 to Unicode mapping table (CP1252.TXT)

Cite this calculator

Speedy Calculator. (2026). Text to Hex Converter. Speedy Calculator. https://speedycalculator.com/calculators/other/text-to-hex/