Base64 Encoder and Decoder
Choose encode or decode and type your text. You get the result and the sizes in bytes and characters. Everything is worked out on this page and nothing is sent anywhere.
Your numbers
How we calculate it
Base64 writes bytes using 64 safe characters (A to Z, a to z, 0 to 9, + and /). Every 3 bytes become 4 characters: the 24 bits are split into four groups of 6 bits and each group picks one character. If the last group has only 1 or 2 bytes, the output is padded with one or two = signs. The URL-safe form uses - and _ in place of + and /, so the text can go in a URL.
Text is first turned into UTF-8 bytes, so accents, other alphabets and emoji work: "Hello, World!" becomes SGVsbG8sIFdvcmxkIQ==, and "€" becomes 4oKs. Decoding accepts either alphabet, ignores spaces and line breaks and does not need the = padding, then reads the bytes as UTF-8 text.
Assumptions and limits
- Base64 is an encoding, not encryption. Anyone can decode it, so do not use it to hide secrets or passwords.
- Encoded data is about 33% larger than the original. The limit is 4,000 characters of input.
- If the decoded bytes are not valid UTF-8 text, for example an image file, the calculator says so instead of showing garbled characters.
Frequently asked questions
What is Base64 used for?
It lets binary data travel through systems made for text, such as email, JSON, HTML data URLs and some web headers.
Why does Base64 end with = signs?
The = signs are padding. They make the length a multiple of 4 when the last group of bytes is not complete. The URL-safe form often leaves them off.
Can I encode a file here?
No. This page encodes and decodes text. A file is binary data, which needs a tool that can read the file.
Related calculators
- URL Encoder and DecoderChoose encode or decode, pick the style and type your text.
- Binary and Hex ConverterType a whole number, say which base it is in and which base you want.
- Data Storage ConverterEnter an amount of data, choose the unit it is in and the unit you want.
- Hex to RGB Color ConverterType a color as hex, rgb() or hsl().
Worked example (a fixed example using the starting numbers, it does not change as you type)
Inputs: Mode = Encode text to Base64; Text or Base64 = Hello, World!; Alphabet = Standard (+ and /); Padding with = = Yes.
- Result SGVsbG8sIFdvcmxkIQ==
- Input size 13 bytes
- Output size 20 characters
Embed this calculator
Add this calculator to your own page. Paste the code where you want it. The small link keeps credit to the source.