SITE UNDER CONSTRUCTION. Everything here is provided AS IS, WITHOUT WARRANTIES, to the extent the law allows. It is information, not professional advice. Use at your own risk. Terms and liability limits →

eThorns ES
← DeveloperES

Tool 5.4

Base64 encode & decode (text and files, UTF-8)

Encode or decode Base64 in your browser: UTF-8 text, URL-safe Base64, files to Base64 or data URLs, and Base64 back to a downloadable file.

Runs on your deviceRuns entirely in your browser: nothing you type or upload leaves your device.

How to use it

  1. Paste text, or drop a file to get its Base64 and data URL.
  2. Press Encode or Decode; tick URL-safe for Base64URL (used in JWTs and URLs).
  3. Copy the result, or use Decode to file to download the original file.

Where you run into Base64

Base64 turns any data into letters, numbers, + and /, so it can travel through systems made for text. You meet it in email attachments inside the raw message, in images embedded in web pages as data URLs, in API fields that expect a file as text, in each part of a JWT, in the Authorization: Basic header of web requests, and in configuration files that store keys or certificates.

This tool encodes and decodes it in both directions, for text and for files, without sending anything to a server.

Example: why `año` becomes eight characters

Type ano and press Encode: you get YW5v, four characters for three letters. Type año and you get YcOxbw==. The ñ takes two bytes in UTF-8, the standard way to store text, so there are four bytes to encode, and the == at the end is padding that fills the last group of four characters.

Now try the other way. Paste dXN1YXJpbzpjbGF2ZQ== and press Decode: it reads usuario:clave. That is exactly how the Basic authentication header of a website carries a user and password. Anyone who sees that header can read the password in one click, which is why it must only travel over HTTPS.

Base64 is not a lock

The usual mistake is treating Base64 as protection. A password, API key or ID number written in Base64 is not hidden; it is only harder to read at a glance. Base64 also makes data about a third bigger, so it isn't a way to compress anything.

Text is read and written as UTF-8. Some older systems still save text as Latin-1 (ISO-8859-1) or Windows-1252, where ñ is a single byte. If you decode Base64 from one of them, the tool says the data isn't UTF-8 text. Use Decode to file and open the file in a text editor that lets you choose that encoding. Files up to 25 MB can be encoded; very long results are shown cut, but Copy always takes the full text.

FAQ

How do I turn Base64 back into a PDF or an image?

Paste the Base64, or the whole data URL that starts with something like `data:application/pdf;base64,`, and press Decode to file. The file name comes from the data URL's type; without one, the tool recognizes PDF, PNG, JPG, GIF and ZIP by their first bytes and saves `decoded.pdf`, `decoded.png` and so on. Anything else is saved as `decoded.bin`, which you rename with the right extension. Word and Excel files are ZIP files inside, so they come out as `decoded.zip`: rename them to `.docx` or `.xlsx`.

Why does Decode say the data is not UTF-8 text?

Either the Base64 holds a file (an image, a PDF, a ZIP) rather than text, or it holds text saved as Latin-1 or Windows-1252, as some older systems do. In those encodings ñ and accented letters are single bytes that aren't valid UTF-8. In both cases use Decode to file; for text, open the file in an editor that lets you choose the encoding.

What is URL-safe Base64?

A variant that uses - and _ instead of + and / and drops the = padding, so it can go in URLs and file names. JWTs and many web APIs use it.

What do the = signs at the end mean?

They are padding. Base64 works in groups of 3 bytes written as 4 characters; when the data doesn't fill the last group, one or two = signs complete it. URL-safe Base64 usually leaves them out, and this tool decodes either form.

Why does it say "This is not valid Base64"?

The text has a character outside the Base64 alphabet (letters, digits, `+`, `/`, `-`, `_`, and `=` at the end), or it was cut while copying and the last group is incomplete. Spaces and line breaks are ignored, so Base64 split across several lines decodes fine.

  • 5.1JSON formatterFormat or minify JSON and find syntax errors by line and column.
  • 5.2CSV to JSON converterConvert CSV to JSON or JSON to CSV with comma, semicolon or tab separators.
  • 5.3YAML to JSON converterConvert YAML to JSON and back in your browser.
  • 5.5Color contrast checkerCheck the contrast ratio of a text color on its background against WCAG 2.2 AA and AAA, for normal text, large text and UI components.
  • 5.6Cron explainerRead a 5-field cron expression as a plain sentence and see its next 5 run times in your time zone.
  • 5.7Number base converterConvert whole numbers between decimal, hexadecimal, binary and octal, with bit length and grouped digits.
  • 5.8HTML entity encoderEncode text as HTML entities (named, decimal or hex) or decode entities back to text: <, >, &, quotes, Spanish accents, Latin-1 symbols.
  • 5.9URL encodePercent-encode or decode URLs and query values, and break any URL into protocol, host, path, query parameters and fragment.
  • 5.10SHA-256 hashGet SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text or files and verify a download against its published checksum.
  • 5.11UUID generatorGenerate random UUID v4 or time-ordered UUID v7 (RFC 9562) in your browser, 1 to 1000 at a time, in uppercase or without dashes.
  • 5.12Unix timestampConvert Unix timestamps in seconds or milliseconds to ISO 8601, UTC and your local time, or a date back to epoch.
  • 5.13JWT decoderDecode a JSON Web Token in your browser: see the header and payload as formatted JSON and whether it has expired.
  • 5.14Regex testerTest regular expressions live: highlighted matches, capture and named groups, flags and clear errors.

╌╌ END ╌╌