Skip to main content

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​

  1. Paste text β€” Plain text input.
  2. Pick encoding(s) β€” Multiple shown side-by-side. Each updates live as input changes.
  3. 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.

Open the tool β†—


Last updated: 2026-05-06 Β· Author: Ahsan Mahmood Β· Edit this page on GitHub