🔐 String Encoder/Decoder

Encode and decode HTML entities, URL encoding, Base64, and Unicode escapes.

Encoded / Decoded Result

Understanding String Encoding

String encoding converts text characters into a different format for safe storage, transmission, or display. Different encoding systems exist because different contexts have different rules about which characters are "safe" and which have special meaning. This tool supports four essential encoding formats used in web development, programming, and data processing.

URL Encoding (Percent Encoding)

URL encoding, formally defined in RFC 3986, converts characters that are unsafe or reserved in URLs into a % followed by two hexadecimal digits representing the character's byte value.

Common conversions: space → %20, & → %26, = → %3D, ? → %3F, / → %2F, + → %2B, @ → %40.

Use URL encoding when: building dynamic URLs with query parameters, handling form submissions, working with REST APIs that pass data in URL parameters, or generating redirect URLs.

HTML Entity Encoding

HTML entity encoding converts characters that have special meaning in HTML markup into safe named or numeric entity references. This is a critical security technique for preventing Cross-Site Scripting (XSS) attacks.

Core conversions: < → &lt;, > → &gt;, & → &amp;, " → &quot;, ' → &#x27;.

Use HTML encoding when: inserting user-generated content into HTML pages, displaying code examples in HTML, rendering text that might contain < or & characters in HTML, or sanitizing data before storing in HTML templates.

Base64 Encoding

Base64 converts any data (text or binary) into a string using only 64 safe ASCII characters (A-Z, a-z, 0-9, +, /, and = for padding). The output is approximately 33% larger than the input but is completely safe to transmit through any text-based channel.

Important: Base64 is encoding, not encryption. It can be instantly decoded by anyone without a key. Never use it to protect sensitive information — it provides no security.

Use Base64 when: embedding images directly in CSS (data:image/png;base64,...), transmitting binary data in JSON or XML APIs, working with JWT (JSON Web Token) payloads, encoding email attachments (MIME), or storing binary data in text-only formats.

Unicode Escape Sequences

Unicode escaping represents characters using their Unicode code point in \uXXXX format (4-digit hex for Basic Multilingual Plane characters) or \u{XXXXX} for higher planes. Every printable Unicode character has a unique code point.

Examples: é → \u00E9, 中 (Chinese "middle") → \u4E2D, emoji 🚀 → \u{1F680}.

Use Unicode escapes when: working with older codebases that only support ASCII source files, writing JavaScript or JSON that needs to be read by strict ASCII parsers, representing non-Latin characters in Java .properties files, or when debugging character encoding issues.

Practical Use Cases

  • API development: URL-encode query parameters before appending them to API endpoint URLs. URL-decode parameters received in webhook payloads.
  • XSS prevention: HTML-encode any user-generated text before rendering it in HTML to prevent script injection attacks.
  • Data URIs: Base64-encode small images to embed them directly in HTML/CSS without a separate HTTP request, reducing page load time.
  • JWT inspection: Base64-decode the payload section of a JWT token (the middle section between the two dots) to read its claims without using a specialized tool.
  • Debugging encoding issues: Use Unicode escape to identify exactly which code point a mystery character is — useful when debugging text corruption or charset mismatches.
  • Email links: URL-encode the body and subject of mailto: links so that special characters in your pre-filled email body don't break the URL.

Related Tools

  • Text to Slug — Convert text to URL-safe slugs for use in web addresses.
  • Find & Replace — Edit encoded strings or clean up encoding artifacts.
  • Case Converter — Normalize case before encoding for consistent output.
  • Word Counter — Check the length of encoded strings before using in size-limited fields.

Frequently Asked Questions

What encoders/decoders are supported?

We support URL Encoding (percent encoding), HTML Entities Encoding, Base64 Encoding and Decoding, and Unicode Escape/Unescape. All operations work both ways — you can encode and decode with each format.

Why encode strings?

Encoding converts special characters into safe representations for specific contexts. URL encoding makes query parameters safe in web URLs. HTML encoding prevents XSS attacks by making < and > non-executable. Base64 makes binary data safe to embed in text formats like JSON, CSS, or email. Unicode escaping makes non-ASCII characters safe in ASCII-only source code.

Is Base64 a form of encryption?

No — Base64 is encoding, not encryption. It can be decoded by anyone instantly without a key. Never use Base64 to protect sensitive data. It is designed to safely transport binary or non-ASCII data through text-based channels (like JSON, XML, or email), not to conceal data.

What is the difference between URL encoding and HTML encoding?

URL encoding (percent encoding) converts characters that are unsafe in URLs into %XX format, where XX is the hexadecimal Unicode code point. HTML entity encoding converts characters that have special meaning in HTML (<, >, &, ", ') into named or numeric HTML entities (&lt;, &gt;, &amp;). They are completely different formats for completely different contexts.

When should I use Unicode escape sequences?

Unicode escape sequences (é for é) are used in programming contexts where you need to represent a non-ASCII character in source code that only supports ASCII. This is common in older JSON files, Java .properties files, JavaScript ES5 string literals, and email headers. Modern systems usually support UTF-8 directly, so Unicode escapes are less commonly needed today.

Is my data secure when using this tool?

Yes — everything happens strictly within your browser using JavaScript. No encoded or decoded string is ever transmitted to any server. This makes the tool safe to use with sensitive strings like API keys, tokens, database connection strings, and personal data.

What does percent encoding mean in URLs?

Percent encoding (also called URL encoding) is the standard defined in RFC 3986 for encoding reserved and unsafe characters in URLs. Each unsafe character is replaced by a "%" followed by two hexadecimal digits. For example: space becomes %20, forward slash becomes %2F, plus sign becomes %2B, and the at symbol becomes %40.