Encode and decode Base64 strings instantly.
The Base64 Encoder Decoder converts text or files to Base64 and decodes Base64 back to text. It handles UTF-8 correctly (accents, non-Latin scripts and emoji), supports URL-safe Base64, accepts line-wrapped or unpadded input, and runs entirely in your browser.
Made for developers. Typical uses:
Encoding the plain text "Hello" produces the Base64 string "SGVsbG8=" — the "=" at the end is padding, added because Base64 always outputs in 4-character blocks and "Hello" doesn't divide evenly into 3-byte chunks. Paste "SGVsbG8=" back into the decoder and it returns "Hello" exactly, since Base64 is fully reversible with no data loss.
Base64 is an encoding, not encryption, so anyone can decode it. Decoded binary data such as images is offered as a download rather than shown as text. Files up to 20 MB can be encoded.
Accuracy: Output is tested against known inputs. For production code, review the result and run your own tests.
Expert Tip
If a decoded result looks like garbage, check whether the source used URL-safe Base64 (which swaps + and / for - and _) — standard decoders can fail on those characters until you convert them back.
Base64 represents any data using 64 safe characters: the letters A to Z and a to z, the digits 0 to 9, plus and slash, with equals signs as padding. It exists because many systems, such as email and JSON, can carry text but not raw bytes. Encoding turns bytes into text and decoding turns the text back into bytes. Every 3 bytes become 4 characters, so the text is about a third bigger.
The Base64 Encoder Decoder handles both directions and treats your text as UTF-8, so accents, non-Latin scripts and emoji survive.
These results come straight from the encoder.
Two checkboxes change how the output is written.
You can also choose a file to encode, up to 20 MB, which is how images and documents are embedded in JSON, CSS or email. Decoding data that is not text, such as an image, offers the result as a download instead of showing unreadable characters. For images specifically, the Image to Base64 tool produces ready-to-paste data URIs and HTML.
Anyone can decode Base64 in a second, so never use it to hide a password or a secret. It is also not a hash: a hash cannot be reversed, but Base64 can. Base64, hashing and encryption: what is the difference? explains where each belongs. To create a one-way fingerprint of text, use the Hash Generator, and to percent-encode text for a URL use the URL Encoder Decoder.
All encoding and decoding happens in your browser, and nothing is uploaded.
Base64 appears in more places than most people notice. Email attachments travel as Base64 inside the message. Data URIs embed small images in HTML and CSS. JSON Web Tokens use a URL-safe form to carry their header and payload. APIs often accept a file as a Base64 string in a JSON body, and some services return one. HTTP basic authentication sends the user name and password joined by a colon and encoded in Base64, which is encoding for transport and not protection, so it must only ever be used over HTTPS.
Decoding fails when the text has been cut off, when line breaks were added or lost, or when the standard and URL-safe alphabets are mixed up. The tool accepts line-wrapped and unpadded input, which covers most copy-and-paste damage. If the result is unreadable, the data may not have been text in the first place, which is why a decoded file is offered as a download. Always compare the length: a valid Base64 string without padding has a length that leaves a remainder of 2 or 3 when divided by 4.
Base64 is not encryption and a hash cannot be reversed. See what each does, where JWTs and URL encoding fit, and how to pick MD5, SHA-256 or a password hash.
Explore more in Developer Tools, read the guides and articles, or see how we test our tools.
Encode text and data to Base32 format.
Best for generating or inspecting a Base32-encoded TOTP secret key for two-factor authentication setup
Check color contrast ratios for WCAG compliance.
Best for checking that body text color meets WCAG AA contrast requirements before shipping a website
Parse and understand cron expressions with human-readable descriptions.
Best for confirming a scheduled job in a server crontab actually runs when you think it does before deploying it
Convert external CSS to inline styles for HTML emails.
Best for converting a designed HTML email template into inline-styled markup before sending a campaign
Format and beautify messy CSS code with proper indentation.
Best for beautifying minified CSS for editing
Minify and compress CSS stylesheets to reduce file size.
Best for shrinking a stylesheet before deploying it to a production website to reduce load time