Base64, URL and HTML Encoder

Encode or decode Base64 with full UTF-8 support, percent-encode URL parameters and escape HTML entities, each in one click, in your browser.

The interactive tool loads here when JavaScript runs.

About this tool

What is Base64, URL and HTML Encoding?

This page groups three encoders that developers reach for constantly: Base64, URL (percent) encoding and HTML entity encoding. Each tab encodes or decodes text in one click, and the result can be copied straight to the clipboard.

They solve different problems. Base64 turns bytes into a safe alphabet so binary data can travel through text-only channels. URL encoding makes text safe inside a query string or path segment. HTML encoding makes text safe to place inside an HTML page without it being treated as markup.

All three work on text. Base64 encoding first converts your text to UTF-8 bytes, so accented letters and emoji round-trip correctly. The decoder expects the standard alphabet and that the decoded bytes are valid UTF-8 text, so it is not the right place to decode a Base64 image or other binary file.

  • UTF-8 Base64 encoding and decoding, including emoji and non-Latin text
  • URL encode and decode with encodeURIComponent and decodeURIComponent
  • HTML entity encode and decode for & < > " and ' in a single pass
  • One-click copy of the result
  • Everything runs in your browser
Read the guide: Base64, URL and HTML Encoding Explained (and When to Use Each)

Updated

How to use Base64, URL and HTML Encoding

  1. Choose the Base64, URL or HTML tab.
  2. Paste or type your text into the input box.
  3. Click the button for the direction you need: Encode Base64, Decode Base64, URL Encode, URL Decode, HTML Encode or HTML Decode.
  4. Copy the result with the copy button next to the output.

Worked examples

UTF-8 text in Base64

Input

café

Output

Y2Fmw6k=

é is two bytes in UTF-8 (C3 A9), so the 4-character word is 5 bytes and needs one = of padding. A Latin-1 encoder would give a different, shorter result.

A query parameter value

Input

price < 10 & tag=c#

Output

price%20%3C%2010%20%26%20tag%3Dc%23

Unencoded, the & would start a new parameter and the # would start a fragment, so the server would only see "price < 10 ".

Decoding an entity that was escaped twice

Input

&amp;lt;b&amp;gt;

Output

&lt;b&gt;

HTML Decode removes exactly one layer, so double-escaped text comes back as the escaped text it really contains rather than as a live <b> tag.

Background and insight

Base64 dates back to the email standards of the late 1980s and early 1990s. Mail servers were built for 7-bit text, so attachments had to be re-expressed using only letters, digits, plus, slash and the padding character. MIME (RFC 2045) made it the standard attachment encoding, and RFC 4648 later defined it formally alongside the URL-safe variant that JWTs use.

A detail worth remembering is that Base64 makes data about a third larger: every 3 input bytes become 4 output characters. It is an encoding, not encryption. Anyone can decode it, so seeing a Base64 string in a config file tells you nothing about whether the value inside is secret.

URL encoding is defined by RFC 3986. The browser function used here, encodeURIComponent, escapes everything except letters, digits and - _ . ! ~ * ' ( ), which is the right choice for a single query parameter value. HTML encoding is about context: the five characters & < > " and ' are the ones that can break out of text or attribute values, which is why they are the ones this tool escapes.

Common use cases

  • Reading a Basic Auth header

    Decode the value after "Basic " in an Authorization header to see the username:password pair it carries. dXNlcjpwYXNz decodes to user:pass.

  • Building query strings

    URL-encode a search term containing spaces, ampersands or slashes before adding it to a link.

  • Escaping user content

    HTML-encode a snippet before pasting it into a page or template so tags show as text instead of rendering.

  • Debugging config values

    Decode a Base64 value from a Kubernetes Secret or an environment variable to check what it actually contains.

Tips and limitations

  • To decode Base64URL (JWT parts, some API keys), replace - with + and _ with / first. The decoder here expects the standard alphabet.
  • Kubernetes Secret values are Base64, not encrypted. Anyone who can read the Secret object can decode it in one step.
  • Do not URL-encode a whole URL. Encode each parameter value separately, or the :// and / that structure the URL get escaped too.
  • HTML Decode handles the five entities this page produces (&amp; &lt; &gt; &quot; &#39;). Named entities like &copy; and numeric ones like &#8364; are left as they are.
  • Use the Base64 Image Converter for pictures and files; this decoder only returns text.

Sources and further reading

  1. RFC 4648: The Base16, Base32, and Base64 Data Encodings, IETF. Defines standard Base64, padding and the URL-safe alphabet
  2. RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One, IETF. Where Base64 became the email attachment encoding
  3. RFC 3986: Uniform Resource Identifier (URI): Generic Syntax, IETF. The percent-encoding rules behind URL encoding
  4. encodeURIComponent(), MDN Web Docs
  5. Cross Site Scripting Prevention Cheat Sheet, OWASP. Why HTML output encoding matters

Frequently asked questions

Is Base64 a form of encryption?

No. Base64 is a reversible encoding with no key, so anyone who sees a Base64 string can decode it in a second. It only changes which characters represent the data. Use real encryption, such as AES-GCM, or a secrets manager when a value must stay confidential.

Why does Base64 output end with = or ==?

Base64 encodes 3 bytes at a time into 4 characters. When the input length is not a multiple of 3, the last group is short, and one or two = characters pad the output to a multiple of 4. One leftover byte gives ==, two leftover bytes give =.

What is the difference between Base64 and Base64URL?

Base64URL replaces + with - and / with _ so the string is safe in URLs and filenames, and it usually drops the = padding. JWTs, many OAuth values and some API keys use it. Swap the two characters back before decoding with a standard Base64 decoder.

Should I use encodeURIComponent on a whole URL?

Usually not. encodeURIComponent is meant for one component, such as a query parameter value or a path segment. Applied to a full URL it also escapes the colon, slashes and question mark that give the URL its structure, so the result is no longer a working link.

Why does HTML encoding matter for security?

If user-supplied text containing < or " is inserted into a page unescaped, the browser can treat it as markup or script. Escaping those five characters is a core defence against cross-site scripting, although templates in React, Vue or Jinja usually do it for you automatically.

Why does Decode Base64 say the string is invalid?

The input contains characters outside the standard alphabet, often - or _ from Base64URL, or the decoded bytes are not valid UTF-8 text because the data is an image or other binary file. Convert URL-safe characters first, or use a binary-aware tool for files.

Is there an in-depth guide to Base64, URL and HTML Encoding?

Yes. “Base64, URL and HTML Encoding Explained (and When to Use Each)” covers the background, how it works, common pitfalls and worked examples. Read the full guide.