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.
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
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.
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.
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.
| Aspect | Detail |
|---|---|
| Runtime | 100% client-side processing (no server upload). |
| Variant scope | Encode page (text → Hex) |
| Limits | ~1–2MB chars; ~25000 ms timeout |
| Retention | All processing happens locally in your browser (no upload) |
| Input | Text (interpreted as bytes using the selected character set) |
| Output | Text (hex digits, optionally tokenized/prefixed depending on format) |
Mini Example
A minimal encode example using the default plain hex format.
Input (text): Hello
Output (plain hex, UTF-8): 48656c6c6f
Errors & Edge Cases
Encoding is usually straightforward; most surprises come from text-to-bytes choices and formatting expectations.
| Symptom | Likely cause | What to check |
|---|---|---|
| Output doesn't match another tool | Different character set (text → bytes) or different formatting style | Confirm "Character set" and Hex format (plain vs 0x vs \xHH vs %HH), plus casing/separators |
| Unexpected line breaks | Wrapping or final newline enabled | Set "Wrap bytes per line" to 0 to disable wrapping; toggle "Insert final newline" |
| Per-line output differs from whole-text encoding | Line-by-line mode changes how input is segmented | Disable "Process line by line" if you want a single continuous encoding |
| Format looks wrong for the target system | Chosen output format doesn't match consumer expectations | For 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 inputs | Input exceeds client-side limits | Keep 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 256xxd 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?
API.Is processing local or remote?
Can I paste secrets (API keys, passwords, tokens)?
Why doesn't my encoded output match another hex tool?
What's the difference between "plain", "0x", "\xHH" and "%HH" output?
Pro Tips
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.
When output differs across tools, verify the "Character set" (text → bytes) before blaming the hex encoder.
For clean diffs and piping, keep wrapping disabled (bytesPerLine = 0) and enable "Insert final newline" only when your workflow expects it.
For secrets or regulated data, encode locally in CI or on your machine rather than relying on browser clipboard workflows.
Additional Resources
Other Tools
- CSS Beautifier
- HTML Beautifier
- Javascript Beautifier
- PHP Beautifier
- Color Picker
- Sprite Extractor
- Base32 Binary Encoder
- Base32 Decoder
- Base32 Encoder
- Base58 Binary Encoder
- Base58 Decoder
- Base58 Encoder
- Base62 Binary Encoder
- Base62 Decoder
- Base62 Encoder
- Base64 Binary Encoder
- Base64 Decoder
- Base64 Encoder
- Hex Binary Encoder
- Hex Decoder
- Csharp Formatter
- Csv Formatter
- Dockerfile Formatter
- Elm Formatter
- ENV Formatter
- Go Formatter
- Graphql Formatter
- Hcl Formatter
- INI Formatter
- JSON Formatter
- Latex Formatter
- Markdown Formatter
- Objectivec Formatter
- Php Formatter
- Proto Formatter
- Python Formatter
- Ruby Formatter
- Rust Formatter
- Scala Formatter
- Shell Script Formatter
- SQL Formatter
- SVG Formatter
- Swift Formatter
- TOML Formatter
- Typescript Formatter
- XML Formatter
- YAML Formatter
- Yarn Formatter
- CSS Minifier
- Html Minifier
- Javascript Minifier
- JSON Minifier
- XML Minifier
- Http Headers Viewer
- PDF To Text
- Regex Tester
- Serp Rank Checker
- Whois Lookup