Base64 Encoder and Decoder
Encode text or files to Base64 and decode Base64 back to text, an image or a file.
Runs entirely in your browser. Nothing you paste is sent to our server, stored or logged.
Base64
Type text to encode it, or paste Base64 to decode it. Text is handled as UTF-8, so accents, Chinese characters and emoji come through intact. Base64 that holds an image or a file is recognized, previewed when it is an image, and can be downloaded as the original file.
What Base64 is for
Base64 writes any data with 64 safe characters: A to Z, a to z, 0 to 9, + and /. It exists so binary data such as images, keys and attachments can travel through systems built for text, like email, JSON, HTML and HTTP headers. It is an encoding, not encryption: anyone can decode it, so it never hides a password or a token.
Why the result is longer
Every 3 bytes become 4 characters, so Base64 is about a third larger than the original. When the data is not a multiple of 3 bytes, one or two = signs pad the end. Text is turned into bytes with UTF-8 first, which is why a single emoji, 4 bytes long, encodes to 8 characters: 8J+YgA==.
Standard and URL safe Base64
The + and / of standard Base64 mean something else in URLs and file names. The URL safe form from RFC 4648 uses - and _ instead and usually drops the padding; JWTs and many APIs use it. The decoder reads both forms, with or without padding, and skips line breaks, so Base64 pasted from an email or a PEM file works as it is.
How to use the base64 encoder
- Choose a directionPick Encode to turn text or a file into Base64, or Decode to read Base64.
- Paste or choose a fileResults appear as you type. To encode an image or another file, choose it from your computer.
- Copy the resultCopy it, swap it back to check the round trip, or download a decoded file.
Common questions
Is Base64 encryption?
No. Base64 only changes how data is written, and anyone can decode it in a second. Use real encryption for anything secret, and treat Base64 encoded tokens and passwords as if they were plain text.
How do I convert an image to Base64?
Choose Encode, then Choose a file and pick the image. Tick As a data URI to get a value you can put straight into an img tag's src or a CSS url().
Why does my decoded text look garbled?
The data is either binary, such as an image or a zip file, or text in an older encoding than UTF-8. The decoder tells you which: files are named and can be downloaded, and Latin-1 text is shown as Latin-1 with a note.
What does the = at the end mean?
It is padding. Base64 works in groups of 4 characters, and one or two = signs fill the last group when the data does not divide evenly. Many systems drop it, and this decoder accepts Base64 with or without it.
Why not just use btoa and atob?
JavaScript's btoa only accepts Latin-1 characters and fails on emoji and most other scripts, and atob returns bytes as a string that is easy to misread. This tool encodes the UTF-8 bytes of your text, which is what servers and other languages expect.
Is my data uploaded?
No. Encoding and decoding happen in your browser, files are read on your own computer, and nothing is sent to our server or stored.
More developer tools
Like this one, every developer tool here runs in your browser and never sends what you paste to a server.
JSON Formatter and Validator
Pretty print, minify and validate JSON, with the exact line of any error and how to fix it.
JWT Decoder and Verifier
Decode a JSON Web Token, read its claims and expiry, and verify its signature, all in your browser.
URL Encoder and Decoder
Percent encode text for URLs and decode encoded URLs and query strings back to readable text.
UUID Generator
Generate random version 4 or time ordered version 7 UUIDs, one or a thousand at a time.
Hash Generator
Get the SHA-256, SHA-512, SHA-1 and MD5 hash of any text or file, and check a download's checksum.
Cron Expression Generator
Write a cron schedule, read it in plain English and see when it runs next.
Unix Timestamp Converter
Turn Unix timestamps into readable dates and back, in seconds or milliseconds.
Chmod Calculator
Convert Linux file permissions between numbers and letters, and see who can do what.