Base64 encode and decode
Text toolsHow do you turn text or a file into Base64?
Encode text or a file to Base64 and decode it back, right in your browser.
What you enter stays on your device while you use this tool. Opening a shared link sends the settings in its address to HowToolbox to prepare the page.
Alphabet and files
You can also paste a file. Files stay on your device.
Base64
SGVsbG8sIHdvcmxkIQ==
13 bytes become 20 characters
Sponsored Links
Encode text or a file to Base64 and decode it back, right in your browser.
How to use
- Choose Encode to turn text into Base64, or Decode to turn Base64 back.
- Type or paste the text. To encode a file instead, choose it under Files (up to 5 MB).
- Copy the result, or download it as a file.
- For web addresses and file names, switch on the URL-safe alphabet.
Base64 padding examples
| Text | Base64 |
|---|---|
| f | Zg== |
| fo | Zm8= |
| foo | Zm9v |
| foob | Zm9vYg== |
| fooba | Zm9vYmE= |
| foobar | Zm9vYmFy |
How it works
Base64 writes any data, including a picture or a file, using only 64 safe characters: the letters, the digits, plus and slash. That lets binary data travel through places that only handle text, such as email, JSON or a web address. It is a way of writing data, not a way of hiding it: anyone can decode it.
The data is cut into groups of three bytes (24 bits), and each group is written as four characters of six bits each. So Base64 is a third longer than the original, and a final group of one or two bytes is topped up with = signs. For example the text Man becomes TWFu, and f becomes Zg== (RFC 4648). Text is first turned into bytes as UTF-8, so every language and emoji works.
The URL-safe variant swaps + and / for - and _, so the result needs no escaping in an address or file name, and often leaves out the = padding. When decoding, this tool reads both kinds, ignores spaces and line breaks, and rejects anything else. Files up to 5 MB are read and converted in your browser; nothing is uploaded.
Sponsored Links
Frequently asked questions
Is Base64 encryption?
No. Anyone can decode it, so never use it to protect a password or a secret. It only makes data safe to carry as text.
Why is the result longer than the original?
Every three bytes become four characters, so the result is about a third larger. The extra size is the price of using only safe characters.
Why does decoding say the data is not text?
Base64 can hold any file, not just text. If the decoded bytes are not valid UTF-8 text, such as an image, download them as a file instead.
Can I decode Base64 without the equals signs?
Yes. This decoder accepts missing padding when the remaining length is valid.
Does Base64 preserve accented letters and emoji?
Yes. Text is encoded as UTF-8 bytes, so those characters round-trip when decoded as UTF-8.
Next you might need
- UUID generatorRandom UUIDs, version 4 or time-ordered version 7, made on your device., private, runs on your deviceWeb & developerGeneratorEncoding
- Text diffSee additions and removals, line by line or word by word., private, runs on your deviceText toolsChecker
- Number base converterConvert whole numbers between binary, octal, decimal, hexadecimal and any base up to 36., private, runs on your deviceMath & numbersConverterCalculator
- Braille translatorTurn text into Unified English Braille cells and back: letters, capitals, numbers and basic punctuation., private, runs on your deviceText toolsConverterEncoding
- Flag semaphore alphabetTurn text into flag semaphore figures, or read a letter from the positions of the two arms., private, runs on your deviceText toolsConverterEncoding
- Morse code translatorTurn text into Morse code and back, play it as sound or light, decode it from the microphone or camera, or key it by hand., private, runs on your deviceText toolsGeneratorSoundEncoding
More in Text tools
All 9 utilities in Text tools- Word countWords, characters and reading time as you type., private, runs on your device
- Case converterChange letter case and copy any version., private, runs on your device
- Morse trainerLearn Morse code the Koch way: hear random groups at full speed, type them, and add a character at 90 % accuracy., private, runs on your device
- Typing testYour typing speed in words per minute, with your accuracy and the keys you miss most., private, runs on your device
Popular now
Sponsored Links
Sponsored Links
Sponsored Links