Base64 Converter: Encode and Decode Text
Encode text to Base64 or decode Base64 back to text, with URL-safe output and line-by-line processing.
Base64 encoder and decoder
This tool encodes text into Base64 and decodes Base64 strings back into readable text, entirely in your browser. Switch between encode and decode mode, or use the swap button to reverse the current result and flip modes in one step.
How Base64 encoding works
Base64 turns raw bytes into printable characters by grouping them three bytes (24 bits) at a time and splitting each group into four 6-bit chunks. Each chunk maps to one of 64 characters: A-Z, a-z, 0-9, plus "+" and "/". When the input is not a multiple of three bytes, the output is padded with one or two "=" signs so the result stays a multiple of four characters. The URL-safe option replaces "+" with "-" and "/" with "_", and drops the "=" padding, so the string can go straight into a URL path or filename. When decoding, any spaces or line breaks in the pasted text are stripped automatically before the remaining characters are interpreted.
Worked example
Encoding "Man" (3 bytes) produces "TWFu" with no padding, since three bytes divide evenly into four Base64 characters. Encoding "Hello, World!" (13 bytes) produces "SGVsbG8sIFdvcmxkIQ=="; the two trailing "=" characters mark that the last group was one byte short of a full three-byte block. Turning on URL-safe mode for the same input produces "SGVsbG8sIFdvcmxkIQ", with the padding removed.
Before and after
Input (UTF-8 text):
Hello, World!
Encoded (Base64):
SGVsbG8sIFdvcmxkIQ==
Encoded (URL-safe, no padding):
SGVsbG8sIFdvcmxkIQ
Turning on "process lines separately" encodes or decodes each line of the input on its own and rejoins the results with a separator you choose (line break, comma, semicolon, or space), instead of treating the whole input as one block. A character encoding selector, including UTF-8, ASCII, ISO-8859-1, and Windows-1252, controls how text is turned into bytes before encoding and how decoded bytes are turned back into text. You can also upload a local text file, paste from the clipboard, and download the result as a .txt file, all without anything leaving your browser.