Base64 Encoder and Decoder
Paste text to encode it as Base64, or paste a Base64 string to decode it. Everything runs in your browser and nothing is uploaded.
Result
SGVsbG8sIFdvcmxkIQ==
SGVsbG8sIFdvcmxkIQ
- Input bytes
- 13
- Output characters
- 20
Formula
- Every 3 bytes (24 bits) become 4 characters of 6 bits each
- Alphabet: A to Z, a to z, 0 to 9, + and /
- Output length = 4 × ⌈bytes ÷ 3⌉, padded with =
How the Base64 Encoder and Decoder works
Base64 turns arbitrary bytes into text that survives systems built for plain characters, such as email and JSON. It regroups the data into 6-bit chunks and maps each to one of 64 printable characters.
The encoded form is about 33 percent larger than the original. Base64 is an encoding and not encryption. Anyone can decode it, so it offers no secrecy.
The URL-safe variant replaces + with - and / with _ and usually drops the = padding, so the string can be used in web addresses and file names.
Worked example
"Hello, World!" is 13 bytes. Its Base64 form is SGVsbG8sIFdvcmxkIQ== which is 20 characters including two padding characters.
Frequently asked questions
Why does Base64 end with equals signs?
The equals sign is padding. It fills the last group when the input length is not a multiple of three bytes. One = means two bytes were in the last group, and == means one.
Is Base64 secure?
No. It is a reversible encoding with no key. Never use it to protect passwords or private data.
Related calculators
- Hex Translator: Text to HexadecimalConvert text to hexadecimal bytes and hex back to text using UTF-8. Useful for reading hex dumps and encoding strings.
- Binary Translator: Text to BinaryConvert text to binary code and binary back to text. Uses 8-bit bytes with UTF-8, so it handles ASCII and every other character.
- Text to ASCII and Unicode ConverterConvert text to ASCII codes and Unicode code points in decimal and hex, or turn a list of character codes back into text.
- Morse Code TranslatorTranslate text to Morse code and Morse code back to text. Supports letters, numbers and punctuation in International Morse Code.
- Caesar Cipher Encoder and SolverEncrypt or decrypt text with a Caesar shift cipher. Shows all 25 possible shifts so you can solve a cipher without knowing the key, including ROT13.
- Letter to Number Converter (A1Z26)Convert letters to their alphabet position numbers, where A is 1 and Z is 26, or convert numbers back to letters.
- Hex CalculatorAdd, subtract, multiply and divide hexadecimal, binary, octal or decimal numbers, and apply bitwise AND, OR and XOR. Results in all four bases.
- Chmod CalculatorBuild Unix file permissions by ticking read, write and execute for owner, group and others. Get the octal number, symbolic notation and chmod command.
- IEEE 754 Floating Point ConverterConvert a decimal number to its IEEE 754 single and double precision representation: sign, exponent and mantissa bits, hex value and the exact stored number.
- Subnet CalculatorCalculate the network address, broadcast address, host range, subnet mask and number of hosts for any IPv4 address and CIDR prefix.
Related unit converters
Calculations run in your browser and nothing you enter is sent to a server. Results are provided for general information. Check critical figures independently before relying on them.