Hex to Text Converter Online | Hexadecimal & Plain Text

Encoding
100% client-side. Processed locally in your browser using the Web Crypto API. Nothing is sent to any server.

How It Works

Hex encoding is NOT encryption. Hexadecimal is a representation format for binary data — anyone can convert it back to plaintext. For actual confidentiality, use AES-256-GCM or ChaCha20-Poly1305 encryption.

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

SeparatorExample OutputBest for
None48656c6c6fCompact storage, APIs
Space48 65 6c 6c 6fReadability, debugging
Colon48:65:6c:6c:6fNetwork protocols, MAC addresses
Dash48-65-6c-6c-6fAlternative 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

Confusing hex encoding with encryption. Hex is a representation format, not a security mechanism. Anyone can convert hex back to plaintext. For confidentiality, use encryption (AES-256-GCM).
Odd-length hex strings. Hex strings must have an even number of characters (2 hex digits = 1 byte). An odd-length string indicates a malformed input — validate before conversion.
Case sensitivity. Hex digits can be uppercase (A-F) or lowercase (a-f). Most systems treat them as equivalent, but some APIs are case-sensitive. Normalize to lowercase for consistency.
Ignoring UTF-8 multi-byte characters. Non-ASCII characters (like emoji or CJK) use 2–4 bytes in UTF-8. Converting text to hex and back requires consistent UTF-8 encoding on both sides.
Separator confusion. Different systems use different separators (none, space, colon, dash). Ensure the converter and consumer agree on the format, or strip separators before processing.

Security Notes

Hex is the standard format for cipher output. Hashes, encryption keys, and digital signatures are typically displayed as hex strings for readability and portability.
Uint8Array for Web Crypto API. The browser's Web Crypto API uses Uint8Array (byte arrays) internally. Hex conversion helps inspect and debug these raw byte values.
Validate hex input. Ensure input contains only valid hex characters (0-9, a-f, A-F) and has an even length before conversion to prevent errors.
Use UTF-8 consistently. This tool uses UTF-8 encoding for text conversion. Other encodings (Latin-1, UTF-16) produce different byte sequences — always specify the encoding.

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

Related Concepts

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