Hex to Text Converter Online | Hexadecimal & Plain Text
Encoding How It Works
What Is Hex Encoding?
Hexadecimal (hex) is a base-16 number system used to represent binary data as human-readable text. Each byte (0–255) is represented by two hex digits (00–FF). Hex encoding doubles the data size compared to raw bytes but makes binary data safe for text-based protocols, debugging, and display. It is the standard format for displaying hash outputs, encryption keys, and cipher data.
When to Use Hex Encoding
- Inspecting cipher output — encrypted data, hashes, and signatures are typically displayed as hex strings
- Debugging encoding issues — convert between text and hex to verify byte-level data transformations
- Working with Web Crypto API — the API uses Uint8Array internally; hex conversion helps inspect the raw bytes
- Network protocol analysis — MAC addresses, IP addresses, and protocol fields are often displayed in hex
- Blockchain & cryptography — Bitcoin addresses, transaction hashes, and private keys use hex encoding
Hex Format Options
| Separator | Example Output | Best for |
|---|---|---|
| None | 48656c6c6f | Compact storage, APIs |
| Space | 48 65 6c 6c 6f | Readability, debugging |
| Colon | 48:65:6c:6c:6f | Network protocols, MAC addresses |
| Dash | 48-65-6c-6c-6f | Alternative readability |
Standards Compliance
- RFC 4648 — The Base16, Base32, and Base64 Data Encodings (Base16 = hex)
- IEEE 802 — MAC address format uses colon-separated hex (e.g., 00:1A:2B:3C:4D:5E)
- Web Crypto API — uses Uint8Array (byte arrays) for all cryptographic operations
- Unicode/UTF-8 — text encoding standard; each character may be 1–4 bytes in UTF-8
Last updated:
Code Examples
JavaScript (Browser)
// Text to Hex
function textToHex(text) {
return Array.from(new TextEncoder().encode(text))
.map(b => b.toString(16).padStart(2, '0'))
.join(' ');
}
console.log(textToHex('Hello')); // 48 65 6c 6c 6f
// Hex to Text
function hexToText(hex) {
const bytes = hex.split(' ').map(h => parseInt(h, 16));
return new TextDecoder().decode(new Uint8Array(bytesble));
}
console.log(hexToText('48 65 6c 6c 6f')); // Hello Python
# Text to Hex
text = 'Hello'
hex_str = text.encode().hex()
print(f'Hex: {hex_str}') # 48656c6c6f
# Hex to Text
back = bytes.fromhex(hex_str).decode()
print(f'Text: {back}') # Hello
# With separator
hex_spaced = ' '.join(f'{b:02x}' for b in text.encode())
print(f'Spaced: {hex_spaced}') # 48 65 6c 6c 6f Go
package main
import (
"encoding/hex"
"fmt"
)
func main() {
data := []byte("Hello")
// Text to Hex
hexStr := hex.EncodeToString(data)
fmt.Println("Hex:", hexStr) // 48656c6c6f
// Hex to Text
back, _ := hex.DecodeString(hexStr)
fmt.Println("Text:", string(back)) // Hello
} Rust
use hex::{encode, decode};
fn main() {
let data = b"Hello";
// Text to Hex
let hex_str = encode(data);
println!("Hex: {}", hex_str); // 48656c6c6f
// Hex to Text
let back = decode(&hex_str).unwrap();
println!("Text: {}", String::from_utf8(back).unwrap());
} Node.js
// Text to Hex
const text = 'Hello';
const hex = Buffer.from(text, 'utf-8').toString('hex');
console.log('Hex:', hex); // 48656c6c6f
// Hex to Text
const back = Buffer.from(hex, 'hex').toString('utf-8');
console.log('Text:', back); // Hello
// With separator
const spaced = hex.match(/.{2}/g).join(' ');
console.log('Spaced:', spaced); // 48 65 6c 6c 6f Common Pitfalls
Security Notes
Disclaimer
This tool is provided for educational and development purposes. Hex encoding is a representation format, not encryption — never use it to protect sensitive data. All conversion occurs entirely in your browser.
Further Reading
- RFC 4648 — The Base16, Base32, and Base64 Data Encodings
- MDN — TextEncoder / TextDecoder
- Wikipedia — Hexadecimal
- Wikipedia — UTF-8
Related Concepts
- Base64 Encode/Decode — Binary-to-Text Encoding
- SHA Hash Generator — Hex Output for Hashes
- Key Management — Hex-Encoded Keys
- Hex/Text Converter
Related Tools
Need to encode Base64? Try the Base64 Encode/Decode tool. For generating unique identifiers, see the UUID Generator. You can also encode classical ciphers with the Classical Ciphers Toolkit.
Frequently Asked Questions
Why convert between hex and text?
When working with cryptography tools, output is often displayed as hex strings. Converting between hex and text helps you inspect encrypted data, verify hash outputs, debug encoding issues, and understand the raw bytes behind cipher operations.
What hex output formats are supported?
The converter supports multiple hex output formats: separator options (none, space, colon, dash) for grouping bytes, and case options (lowercase or uppercase). For example, "48656c6c6f" can be formatted as "48 65 6c 6c 6f" (space), "48:65:6c:6c:6f" (colon), or "48-65-6c-6c-6f" (dash).
What is Uint8Array?
Uint8Array is a JavaScript typed array that represents an array of 8-bit unsigned integers (bytes). It is the native format used by the Web Crypto API for all cryptographic operations. Converting to Uint8Array lets you see the exact byte values that cryptographic functions process.
How does the converter detect input format?
You explicitly select the conversion mode: Text → Hex or Hex → Text. This eliminates ambiguity where text like "dead" could be interpreted as either plain text or hexadecimal. In Hex → Text mode, the converter validates that input contains only valid hex characters (0-9, a-f) and has an even length.
Is conversion done in real-time?
Yes, the converter performs real-time conversion with a 150ms debounce delay. As you type, all output formats (hex, text, binary, Uint8Array) are automatically updated without needing to click a convert button.
Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.
More in Encoding
Base64 Encode/Decode
Encode text to Base64 or decode Base64 strings online. Standard and URL-safe variants, hex output, real-time conversion.
UUID Generator
Generate UUID v4 (random) and v7 (time-ordered) online. Configurable format, batch generation (1-1000), validation, timestamp extraction.
Classical Ciphers Toolkit
Encode, decode, and break classical ciphers online: Caesar, Vigenère, Atbash, Rail Fence. Frequency analysis, chi-squared brute force, auto key recovery.