Text to hex converter
Type or paste text and get each byte in hex. Choose spaces, one unbroken run, 0x prefixes or \x escapes.
Byte by byte
Every byte of your input, with the place values that add up to it. Hover a row to find that byte in the output.
| Character | Binary | Place values | Decimal | Hex |
|---|
How text becomes hex
Each character has a number, and hex writes that number in base 16. “A” is 65, which is 4 × 16 + 1, so it is 41 in hex. “a” is 97, or 61 in hex. A space is 20 and the digit “7” is 37.
In UTF-8, characters outside basic English take several bytes: “é” is C3 A9 and “€” is E2 82 AC. In Windows-1252 the same two characters are single bytes, E9 and 80, so the encoding you pick changes the hex.
Pick the output style to suit where the hex is going: “0x prefix, commas” for arrays in C, Java or JavaScript, and “\x escapes” for string literals in C or Python.
| Digit | Place value | Digit × place value |
|---|---|---|
| 4 | 16 | 64 |
| 1 | 1 | 1 |
64 + 1 = 65 = A
Text to hex in code
In Python, "Hi!".encode("utf-8").hex() gives "486921". Add " " as an argument, as in .hex(" "), to put a space between the bytes.
On our other sites
- base64decode.tools: Need Base64 rather than hex? It encodes and decodes Base64 text and files.
Sources and method
- RFC 20 (STD 80), ASCII format for network interchange, section 4: the 128 ASCII codes and control-character names. Checked 2026-11-25.
- RFC 3629 (STD 63), UTF-8, a transformation format of ISO 10646, section 4: which byte sequences are valid UTF-8. Checked 2026-11-25.
- WHATWG Encoding Standard (Living Standard, updated 20 November 2026), section 9 (single-byte encodings, used for Windows-1252) and section 14 (UTF-16LE and UTF-16BE decoders). Checked 2026-11-25.
Hex can be pasted as spaced pairs, one unbroken run (split into pairs), 0x prefixes or \x escapes. Each pair is one byte, and the bytes are decoded with the same rules as the binary translator.
Encoding to UTF-16 writes each 16-bit code unit of the text in the chosen byte order (low byte first for LE, high byte first for BE). The Encoding Standard defines decoders for UTF-16 but not encoders, so this step is the site’s own code.
Questions
Is hex the same as ASCII?
No. ASCII decides which number each character gets; hex is one way of writing that number. “A” is ASCII code 65, which is 41 in hex and 01000001 in binary.
Why are some characters two or more bytes?
UTF-8 uses one byte for the 128 ASCII characters and two to four bytes for everything else, including accented letters, other scripts and emoji.
Upper or lower case hex?
Either is correct; 6C and 6c are the same byte. The converter writes upper case, and reads both.