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.
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).
Try it nowβ
The full string-encoder runs in your browser at https://ztools.zaions.com/string-encoder β no signup, no upload, no data leaves your device.
Last updated: 2026-05-06 Β· Author: Ahsan Mahmood Β· Edit this page on GitHub