Hex Encode/Decode

100% client-side processing (no server upload). Encode text into Hex with selectable output styles (plain, 0x…, C \xHH, %HH), letter case, byte separators, optional wrapping, and configurable line endings.

Loading…

About Hex Encoder (Text)

Use this page to encode text into Hex directly in your browser. Choose an output format (plain hex, 0x… style, C-style \xHH escapes, or percent %HH), control casing and separators, and optionally wrap bytes per line for readability. Need the opposite direction? Use the other page.

Features

  • 100% client-side processing (no server upload).
  • Multiple Hex output formats: plain (deadbeef), 0x… prefix, C escape (\xHH), percent (%HH)
  • Lowercase or uppercase output
  • Byte separators: none, space, colon, dash, underscore, comma
  • Wrap bytes per line (0 disables wrapping)
  • Optional "Insert final newline" for clean file outputs
  • Character set selection (text → bytes). Unsupported charsets fall back to UTF-8.
  • Optional line-by-line processing and selectable line endings (LF or CRLF)

How to use for hex-encoder

1

Paste or drop content

Paste your text into the editor (or drop a text file such as .txt, .md, .json, .yaml). If your input is not plain ASCII, choose the correct "Character set" so bytes are produced as intended.

2

Click "Encode"

Choose your Hex format (plain / 0x / C escape / percent), set letter case and byte separators, and optionally wrap bytes per line. Then click "Encode" to generate the Hex output.

3

Copy or download

Copy the encoded Hex output or download it as a text file. If you enabled "Insert final newline", the output ends with a newline for cleaner diffs and CLI piping.

Technical specifications

Execution Model

This page performs Hex encoding in your browser and does not upload your input to a server.

AspectDetail
Runtime100% client-side processing (no server upload).
Variant scopeEncode page (text → Hex)
Limits~1–2MB chars; ~25000 ms timeout
RetentionAll processing happens locally in your browser (no upload)
InputText (interpreted as bytes using the selected character set)
OutputText (hex digits, optionally tokenized/prefixed depending on format)
Even with local processing, avoid pasting secrets you can't afford to expose (screen sharing, browser extensions, telemetry, and copy/paste history can still leak data). Prefer local tooling for sensitive material.

Mini Example

A minimal encode example using the default plain hex format.

Input (text): Hello
Output (plain hex, UTF-8): 48656c6c6f
The same input produces different Hex only if you change formatting options (format/case/separators/wrapping) or the "Character set" used to convert text into bytes.

Errors & Edge Cases

Encoding is usually straightforward; most surprises come from text-to-bytes choices and formatting expectations.

SymptomLikely causeWhat to check
Output doesn't match another toolDifferent character set (text → bytes) or different formatting styleConfirm "Character set" and Hex format (plain vs 0x vs \xHH vs %HH), plus casing/separators
Unexpected line breaksWrapping or final newline enabledSet "Wrap bytes per line" to 0 to disable wrapping; toggle "Insert final newline"
Per-line output differs from whole-text encodingLine-by-line mode changes how input is segmentedDisable "Process line by line" if you want a single continuous encoding
Format looks wrong for the target systemChosen output format doesn't match consumer expectationsFor C/JS literals use \xHH; for URI-like contexts use %HH; for logs/humans use plain or 0x style with separators
Timeout or tool error on huge inputsInput exceeds client-side limitsKeep input under ~1–2MB characters and consider local CLI encoding for large files

Command line alternatives

For secrets, automation, or CI, encode locally. Below are common, canonical options for text/bytes → Hex.

Linux/macOS

Encode a UTF-8 string to plain hex (xxd)

printf %s "Hello" | xxd -p -c 256

xxd prints bytes as hex. -p outputs plain hex; -c controls columns per line.

Encode a string to hex (Python)

python -c "s='Hello'; print(s.encode('utf-8').hex())"

Encode text to bytes with UTF-8, then convert bytes to hex.

Node.js

Encode text to hex (Node Buffer, UTF-8)

node -e "const s='Hello'; console.log(Buffer.from(s,'utf8').toString('hex'));"

Buffer encodes the string as UTF-8 by default when specified, then renders hex with toString('hex').

Windows PowerShell

Encode text to hex (UTF-8)

powershell -NoProfile -Command "$s='Hello'; $bytes=[Text.Encoding]::UTF8.GetBytes($s); ($bytes | ForEach-Object { $_.ToString('x2') }) -join ''"

Convert the string to UTF-8 bytes and format each byte as two hex digits.

Use cases

Readable byte inspection

  • Turn short text into a hex representation for debugging
  • Generate hex snippets for logs, docs, or tickets

Interoperability with systems that expect hex notation

  • Produce 0x-prefixed or separator-delimited hex for config files and tooling
  • Generate \xHH sequences for embedding bytes into C/JS-like contexts

CI and reproducible fixtures

  • Create deterministic hex fixtures for tests
  • Standardize formatting (case/separators/wrapping) for diffs and reviews

Teaching bytes vs text

  • Show how the chosen character set changes the underlying bytes
  • Demonstrate how formatting options affect representation without changing the bytes

❓ Frequently Asked Questions

Is there a public API?

No. This tool is intended for interactive browser use and does not expose a public API.

Is processing local or remote?

100% client-side processing (no server upload). All encoding runs locally in your browser.

Can I paste secrets (API keys, passwords, tokens)?

It's safer not to. Even with local processing, secrets can leak via screen sharing, browser extensions, clipboard history, or device compromise. For sensitive data, prefer local CLI encoding.

Why doesn't my encoded output match another hex tool?

Most mismatches are caused by different text encodings (character sets) or different output formatting (plain vs 0x vs \xHH vs %HH, separators, wrapping, casing). Align the "Character set" and formatting options to match the target tool/system.

What's the difference between "plain", "0x", "\xHH" and "%HH" output?

They represent the same bytes in different textual notations: plain is continuous hex digits; 0x adds a hex prefix (optionally per byte); \xHH is C-style escaping per byte; %HH matches percent-encoding style used in URI/URL contexts.

Pro Tips

Best Practice

If your goal is compatibility, decide the notation first: plain for dumps, 0x for many dev tools, \xHH for C/JS-like literals, and %HH for URL-style contexts.

Best Practice

When output differs across tools, verify the "Character set" (text → bytes) before blaming the hex encoder.

Performance Tip

For clean diffs and piping, keep wrapping disabled (bytesPerLine = 0) and enable "Insert final newline" only when your workflow expects it.

Security Tip

For secrets or regulated data, encode locally in CI or on your machine rather than relying on browser clipboard workflows.

Additional Resources

Other Tools

🔐 Hex Encoder (Text) — encode text to Hex | Encode64