Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Converters & Encoders
  3. Base64 Encoder/Decoder
Add to favorites

Base64 Encoder/Decoder

Encode and decode text, files and JSON as base64, base64url or hex as you type, with a check that every result decodes back exactly.

Runs locally in your browserMore converters & encodersJump to full guide
Related readingBase64 Encoding Explained: What It Is and When to Use It9 min

Initializing in your browser…

You might also like

URL Encoder/Decoder

Percent-encode and decode URLs as you type in four character sets, build query strings, and take any URL apart parameter by parameter.

JWT Decoder

Decode a JSON Web Token instantly, check its expiry and claims, and verify the signature with a secret, PEM key or JWKS, all in your browser.

Number Base Converter

Convert between binary, octal, decimal, hex and any base to 36 exactly at any size, with bitwise operations, IEEE-754 floats and an ASCII table.

An example conversion

A JSON field only accepts ASCII, and the label you need to store has an accent, an emoji and a currency sign in it.

Text to encode

café ☕ 5€
What Base64 Encoder/Decoder produces

Base64

Standard   Y2Fmw6kg4piVIDXigqw=
URL-safe   Y2Fmw6kg4piVIDXigqw

9 characters, 14 bytes as UTF-8
20 characters out, 143% of the input
Decodes back to the input exactly

Base64 works on bytes, not characters. The nine characters are 14 bytes in UTF-8: one each for c, a, f, the two spaces and the 5, two for é, and three each for the coffee cup and the euro sign. Fourteen bytes are four full groups of three with two bytes left over, so the output is five groups of four characters, and the last group ends with one = to show it carries only two bytes. The URL-safe form drops that padding and is one character shorter. Neither string contains + or /, so the two alphabets agree everywhere else. Paste either one back in with Decode and the original text returns, because the bytes are valid UTF-8.

What this converter does

Base64 turns any data into plain letters, digits and a few symbols so it can travel through places that only accept text, such as JSON fields, email bodies, HTTP headers and URLs. This tool encodes and decodes text, files and JSON as you type, in the standard alphabet, the URL-safe one, or hex, and confirms that every result decodes back to exactly what you started with.

How it works

Base64 writes binary data using 64 printable characters: A to Z, a to z, 0 to 9, plus and slash. Every three bytes become four characters, so encoded data is about a third larger than the original, and one or two equals signs pad the end when the length is not a multiple of three. That size cost is the main reason to use it sparingly. A 30 kB icon becomes roughly 40 kB of text inside your HTML, and inline data cannot be cached by the browser the way a separate file can.

Text is encoded from its UTF-8 bytes, which is what other systems expect. A plain ASCII letter is one byte, an accented letter two, the euro sign three and most emoji four, so the counter under the input shows both characters and bytes. Decoding is where tools tend to go wrong without telling you. If the bytes are not valid UTF-8, a text decoder swaps them for the U+FFFD replacement symbol and carries on. This tool checks, warns you when the result is not really text, and still lets you download the true bytes.

Standard base64 and the URL-safe variant defined in RFC 4648 differ in two characters: URL-safe uses a hyphen and an underscore in place of plus and slash, and usually leaves out the padding. JSON Web Tokens and many web APIs use it. When decoding you do not need to say which one you have. The tool reads either, puts back any missing padding, ignores spaces and line breaks, and accepts a complete data: URL. The alphabet setting only changes what encoding produces.

When a string cannot be decoded you get the reason rather than a generic failure: characters outside the alphabet (listed by name), padding in the middle, more than two padding characters, or a length no valid base64 can have, which is one more than a multiple of four. When encoding, the tool decodes its own output again and compares it with your input byte for byte, and the line under the result confirms the match.

File mode reads the file on your device and produces plain base64 or a data: URL carrying the file's MIME type. Decoded files are saved with an extension chosen from their content, so a PNG comes back as decoded.png instead of an anonymous .bin. JSON mode checks the input is valid, strips formatting whitespace when encoding and indents the result when decoding, without re-reading the numbers, so a 20-digit ID keeps every digit. Keep in mind that base64 is not encryption. Anyone can decode it, so it should never be used to hide a password or a key.

How to use

  1. 1Choose Encode or Decode, then Text, File or JSON.
  2. 2Type or paste into the input box, or drop a file. The result appears as you type, and Try an example fills in a sample.
  3. 3Press Copy to put the result on your clipboard, or Download to save it. When decoding, Download saves the real bytes with a matching file extension.
  4. 4Press the swap button to send the result back through the other way and see the round trip for yourself.
  5. 5Open More options to switch to hex, use the URL-safe alphabet, wrap lines at 76 characters for email, or leave out the data: URL prefix on a file.

Key features

  • Live conversion in both directions, with nothing to press
  • Text, file and JSON input, with drag and drop and a sample image to try
  • Standard and URL-safe (base64url) alphabets, plus hex
  • Decoding accepts either alphabet, missing padding, spaces, line breaks and data: URLs
  • Plain-language reasons for invalid input, naming the characters that do not belong
  • Every encoding is decoded again and checked against your input
  • A clear warning when decoded bytes are not valid UTF-8 text
  • Decoded files saved with the right extension for PNG, JPEG, GIF, WebP, PDF, ZIP, MP3, fonts and more
  • JSON minified or indented without altering any number or string
  • Runs in your browser; a share link carries the settings only, never your data

Tips & best practices

  • Keep data: URLs for small assets. Above roughly 10 kB a separate file that the browser can cache is usually faster.
  • If a server rejects your base64 inside a URL, switch to the URL-safe alphabet. A plus sign in a query string is read as a space.
  • For email attachments and PEM-style output, turn on the 76-character line wrap in More options.
  • When a decoded value triggers the not-text warning, switch to Hex to see the exact bytes before deciding what the data is.

Where this fits

  • Inlining a small image or font

    Encode an icon or a subset font in File mode and paste the data: URL straight into CSS or an img tag, saving one request for an asset too small to be worth it.

  • Sending a file through a JSON API

    Many APIs take attachments as a base64 string field. Encode the file, copy the result, and the check under it confirms nothing was lost on the way.

  • Reading a value out of a log or a token

    Paste a base64 value from a log line, a cookie or one segment of a JWT. Padding and alphabet are worked out for you, and binary content is flagged instead of shown as garbled text.

  • Turning a pasted data URL back into a file

    Switch to File and Decode, paste the data URL, and download it. The file type is recognised from its content, so it opens straight away.

Frequently asked questions

Is base64 a form of encryption?

No. It is an encoding with no key, and anyone can reverse it in a second. It exists to carry binary data through systems that only handle text. Use real encryption for anything secret.

Why is the encoded result bigger than my input?

Each group of three bytes becomes four characters, so the output is about 133 percent of the input size, plus padding and any line breaks. The figure under the result shows the exact ratio for your data.

What is the difference between standard and URL-safe base64?

Only two characters. URL-safe writes a hyphen instead of plus and an underscore instead of slash, because plus and slash have special meanings in URLs and file names, and it usually drops the trailing equals signs. JWTs use the URL-safe form. When decoding, this tool accepts both without being told.

Why does my decoded text show diamond symbols with question marks?

The bytes are not valid UTF-8, so they cannot be shown as text, and each unreadable byte is displayed as U+FFFD. The tool warns you when this happens. The data is probably binary, such as an image or compressed content; use File mode and Download to get the actual bytes, or switch to Hex to see them.

Why is my string rejected for its length?

Base64 is written in groups of four characters, and the last group can be two, three or four characters long but never one. A string whose length is one more than a multiple of four always has a stray or missing character somewhere, often from a copy that cut off the end.

Do I need to add the = padding back before decoding?

No. Unpadded input is accepted, and the tool tells you how many padding characters it added to decode it.

Is my data sent anywhere?

No. Encoding and decoding happen in your browser, and files are read locally. The share button copies a link with your settings, never the text or file you converted.

Related tools and how they differ

  • Image to Base64: Better for images you plan to embed in a page: it can resize and recompress the picture first, then gives ready-made CSS, HTML and Markdown snippets.

Further reading

  • Base64 Encoding Explained: What It Is and When to Use It9 min read

Private by design

Conversions run on your device in JavaScript. The values you enter are never sent over the network.