Encoder / Decoder

Encode and decode Base64, URL, and HTML entities — entirely in your browser

Text
0 chars
Encoded
0 chars

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme defined by RFC 4648. It represents binary data using a set of 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /, with = used for padding. This makes it safe to embed binary data inside text-based formats like JSON, XML, HTML, CSS, and email (MIME).

Common use cases include encoding images as data URIs, transmitting binary data in API payloads, encoding email attachments (MIME), and storing binary data in text-only databases or configuration files.

Base64 encoding increases data size by approximately 33% (every 3 bytes of input become 4 bytes of output). It is not encryption — anyone can decode Base64 without a key.

What is URL Encoding (Percent-Encoding)?

URL encoding, formally called percent-encoding and defined by RFC 3986, replaces unsafe or reserved characters in URLs with a % followed by two hexadecimal digits representing the character's ASCII code. For example, a space becomes %20 and an ampersand becomes %26.

This encoding is essential when passing user input as URL query parameters, constructing API requests with special characters, building OAuth signatures, or encoding form data (application/x-www-form-urlencoded).

Characters that are safe in URLs (unreserved characters) include letters, digits, -, _, ., and ~. Everything else should be percent-encoded when used as data within a URL component.

What is HTML Entity Encoding?

HTML entity encoding converts characters that have special meaning in HTML into their entity references. For example, < becomes &lt;, > becomes &gt;, & becomes &amp;, and " becomes &quot;.

This encoding is critical for preventing Cross-Site Scripting (XSS) attacks — if user input is rendered as HTML without encoding, malicious scripts could execute in the browser. HTML encoding ensures that user-supplied text is displayed as text, not interpreted as markup.

Use HTML encoding when displaying user-generated content on web pages, building HTML strings in JavaScript, or inserting dynamic values into HTML attributes.

Encoding Comparison

Encoding Primary Use Input Example Output Example
Base64 Binary-to-text, data URIs, API payloads Hello! SGVsbG8h
URL Query parameters, form data, API requests a=1&b=2 a%3D1%26b%3D2
HTML XSS prevention, rendering user content <b>hi</b> &lt;b&gt;hi&lt;/b&gt;

Features of This Tool

  • Three encodings in one — Switch between Base64, URL (percent-encoding), and HTML entity encoding with a single click. No need to visit separate tools.
  • Real-time encoding — Text is encoded automatically as you type, with instant feedback. Decoding is available with one click.
  • Swap input/output — One-click swap lets you quickly decode an encoded result or chain multiple operations.
  • Unicode support — Full UTF-8 support for Base64 encoding. Multi-byte characters (emoji, CJK, accented characters) are handled correctly.
  • Character counter — See input and output lengths at a glance, useful for checking size overhead from encoding.
  • 100% client-side — All encoding and decoding happens in your browser. No data is ever sent to any server.
  • No dependencies — Built with vanilla HTML, CSS, and JavaScript. No frameworks, no build tools.

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It's commonly used to embed binary data in text-based formats like JSON, XML, HTML, and email (MIME). Base64 encoding increases data size by approximately 33%.

What is URL encoding (percent-encoding)?

URL encoding (also called percent-encoding) replaces unsafe or reserved characters in URLs with a percent sign (%) followed by their hexadecimal ASCII value. For example, spaces become %20 and ampersands become %26. This ensures URLs are transmitted correctly across the internet.

What is HTML entity encoding?

HTML entity encoding converts special characters into their HTML entity equivalents (e.g., < becomes &lt;, > becomes &gt;, & becomes &amp;). This prevents browsers from interpreting these characters as HTML markup and is essential for preventing XSS (Cross-Site Scripting) attacks.

Is it safe to use this tool?

Yes. All encoding and decoding happens entirely in your browser using JavaScript. No data is ever sent to any server. You can verify this by checking the browser's Network tab. The tool works offline after the initial page load.

Is Base64 the same as encryption?

No. Base64 is an encoding, not encryption. Anyone can decode Base64 without a key — it provides no security or confidentiality. Its purpose is to safely represent binary data in text formats. For actual encryption, use algorithms like AES or RSA.

When should I use URL encoding vs. HTML encoding?

Use URL encoding when putting data into URLs (query parameters, path segments, form submissions). Use HTML encoding when displaying data inside HTML documents to prevent the browser from treating it as markup. They serve different purposes and are not interchangeable.