Use Text to Hex Converter

Enter your data below to use the Text to Hex Converter

📌 Try these examples:
RESULT

Last updated

Text to Hex Converter Examples

The Text to Hex Converter transforms text strings into hexadecimal representation. Below are practical examples covering ASCII encoding, UTF-8 multi-byte characters, and common developer use cases.

Basic ASCII to Hex

// Each ASCII character = 1 byte = 2 hex digits
// Format: character → decimal → hex

A → 65  → 41
B → 66  → 42
Z → 90  → 5A
a → 97  → 61
z → 122 → 7A
0 → 48  → 30
9 → 57  → 39
  → 32  → 20  (space)
! → 33  → 21

Text to Hex (Multiple Formats)

// Input: "Hello"

// Space-separated bytes:
48 65 6C 6C 6F

// Continuous (no spaces):
48656C6C6F

// With 0x prefix:
0x48 0x65 0x6C 0x6C 0x6F

// Lowercase:
48 65 6c 6c 6f

// With \x escape sequences (for code):
\x48\x65\x6C\x6C\x6F

Hex to Text (Reverse Conversion)

// Input hex:
48 65 6C 6C 6F 20 57 6F 72 6C 64

// Decode:
48 = H
65 = e
6C = l
6C = l
6F = o
20 = (space)
57 = W
6F = o
72 = r
6C = l
64 = d

// Output: "Hello World"

UTF-8 Multi-Byte Characters

// é (U+00E9) — 2 bytes in UTF-8:
é → C3 A9

// ñ (U+00F1) — 2 bytes:
ñ → C3 B1

// € (U+20AC) — 3 bytes:
€ → E2 82 AC

// 中 (U+4E2D, Chinese character) — 3 bytes:
中 → E4 B8 AD

// 😀 (U+1F600, emoji) — 4 bytes:
😀 → F0 9F 98 80

// "café" in UTF-8:
c → 63
a → 61
f → 66
é → C3 A9
Full: 63 61 66 C3 A9

Common String Hex Values

// HTTP methods:
"GET"    → 47 45 54
"POST"   → 50 4F 53 54
"PUT"    → 50 55 54
"DELETE" → 44 45 4C 45 54 45

// Common words:
"null"   → 6E 75 6C 6C
"true"   → 74 72 75 65
"false"  → 66 61 6C 73 65

// Line endings:
LF  (\n) → 0A
CR  (\r) → 0D
CRLF     → 0D 0A
Tab (\t) → 09

Hex in Programming Contexts

// C / C++ string literal
const char* hex = "\x48\x65\x6C\x6C\x6F";  // "Hello"

// Python bytes literal
b = b'\x48\x65\x6C\x6C\x6F'  # b'Hello'

// JavaScript
const buf = Buffer.from('48656C6C6F', 'hex');
buf.toString('utf8');  // 'Hello'

// Java
byte[] bytes = hexStringToByteArray("48656C6C6F");
new String(bytes, StandardCharsets.UTF_8);  // "Hello"

// Go
decoded, _ := hex.DecodeString("48656C6C6F")
string(decoded)  // "Hello"

JavaScript Hex Conversion

// Text to hex
function textToHex(text) {
  return [...text]
    .map(c => c.charCodeAt(0).toString(16).padStart(2, '0').toUpperCase())
    .join(' ');
}

// Hex to text
function hexToText(hex) {
  return hex.replace(/\s+/g, '')
    .match(/.{2}/g)
    .map(byte => String.fromCharCode(parseInt(byte, 16)))
    .join('');
}

textToHex("Hello")          // "48 65 6C 6C 6F"
hexToText("48 65 6C 6C 6F") // "Hello"

// Single character
'A'.charCodeAt(0).toString(16).toUpperCase()  // "41"

Python Hex Conversion

// Text to hex
text = "Hello"
hex_str = text.encode('utf-8').hex()          # '48656c6c6f'
hex_spaced = ' '.join(f'{b:02X}' for b in text.encode('utf-8'))  # '48 65 6C 6C 6F'

// Hex to text
bytes.fromhex('48656c6c6f').decode('utf-8')   # 'Hello'

// Single character
hex(ord('A'))          # '0x41'
format(ord('A'), '02X')  # '41'

Hex in Debugging and Analysis

// Hex dump format (common in debuggers and hex editors)
Offset  00 01 02 03 04 05 06 07  ASCII
000000  48 65 6C 6C 6F 20 57 6F  Hello Wo
000008  72 6C 64 0A              rld.

// Identify file type by magic bytes (hex signature):
JPEG:  FF D8 FF
PNG:   89 50 4E 47 0D 0A 1A 0A
PDF:   25 50 44 46  (%PDF)
ZIP:   50 4B 03 04
GIF:   47 49 46 38  (GIF8)

Hex in CSS and Web

// CSS color hex codes (not text encoding, but same hex system)
#FF0000 = Red    (R=255, G=0,   B=0)
#00FF00 = Green  (R=0,   G=255, B=0)
#0000FF = Blue   (R=0,   G=0,   B=255)
#FFFFFF = White  (R=255, G=255, B=255)
#000000 = Black  (R=0,   G=0,   B=0)

// URL percent-encoding uses hex:
space → %20
!     → %21
#     → %23
&     → %26

Common Use Cases

Enter your text to see the hex encoding of each character, or paste hex values to decode them back to text.

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.

Yes! Text to Hex Converter is completely free to use with no registration required. All processing is done client-side in your browser.

Absolutely! All processing happens locally in your browser. Your data never leaves your device, ensuring complete privacy and security.