String Encoder — Multi-Format Online, Free
Encode strings: base64, URL, HTML entities, hex, UTF-16. One-click switch between formats. Browser-only.
About String Encoder
A string encoder transforms a string into a different representation: base64 (binary-safe text), URL-percent (safe in URLs), HTML entities (safe in HTML), hex (raw bytes), UTF-16 (JavaScript-internal). Each is for a specific context — using the wrong encoding causes corruption. The ZTools String Encoder offers all common encodings in one tool with one-click switching, plus a "decode" toggle to reverse any of them.
Use cases
- Encode text for a URL parameter. Spaces, ampersands, special chars need percent-encoding. Tool produces correctly-encoded URL string.
- Embed text in HTML safely. <script>alert("XSS")</script> needs HTML entity encoding to avoid injection. Tool produces safe form.
- Build base64 payloads. JSON over HTTP often base64s binary. Tool builds the encoded string.
- Quick encoding switch. Same input encoded as base64 / URL / hex / HTML side by side.
How it works
- Paste text. Plain text input.
- Pick encoding(s). Multiple shown side-by-side. Each updates live as input changes.
- Toggle decode mode. For decoding, pick the input encoding. Tool reverses.
Examples
Input: "Hello World!"
Output: Base64: SGVsbG8gV29ybGQh. URL: Hello%20World%21. HTML: Hello World! (or just Hello World).
Input: "<script>"
Output: HTML entities: <script>. URL: %3Cscript%3E. Base64: PHNjcmlwdD4=.
Frequently asked questions
Which encoding for which context?
URL params: percent-encoding. HTML body / attributes: HTML entities. Binary in text: base64. Bytes for code: hex. JSON strings: nothing extra (already string-safe).
How is this different from individual encoders?
Convenience tool — all encodings in one view. Useful for comparison + quick switching.
Privacy?
All client-side.
Pro tips
- For URL parameters, encodeURIComponent (full encoding) is usually right — encodeURI leaves some chars unencoded for backwards compatibility.
- For HTML, also escape & — & — most often forgotten.
- For base64 in URLs, prefer base64url variant (replaces +/= with -_ and removes padding).
Reviewed by Ahsan Mahmood · Last updated 2026-05-06 · Part of ZTools.
For the full,
formatted version of this page, please enable JavaScript and reload
https://ztools.zaions.com/string-encoder.