Base64 Encoder & Decoder
Encode text or a file to Base64, or decode a Base64 string back to what it was. Text is encoded as UTF-8 with its whitespace intact, and a file up to 10 MB is encoded byte for byte, with a data URI to copy when the browser reports the file's type. The decoder takes standard or URL-safe Base64, with or without padding and line breaks, and Base64 data URIs. It shows valid UTF-8 as text and offers anything else as a download. Files are read in your browser and are not uploaded.
How to Use This Base64 Tool
- Choose Encode or Decode at the top.
- To encode, pick Text and type into Text to encode, or pick File and drop or browse for a file up to 10 MB.
- Press Encode to Base64, then use Copy Base64 or Download .txt. For a file whose type the browser reports, Copy Data URI copies it as a data URI.
- To decode, paste into Base64 string to decode and press Decode Base64. An invalid string is marked with the reason.
- Read the Decoded text and copy it with Copy Text, or save a decoded file with Download File. A decoded PNG, JPEG, GIF or WebP gets a preview.
How the encoding and the type detection work
Base64 (RFC 4648) writes every 3 bytes as 4 characters from a 64-character alphabet, so the output is about 33% larger than the input and ends in one or two = when the input is not a multiple of 3 bytes. Text has to become bytes first, and this tool uses UTF-8, so é encodes as w6k=. Whitespace counts: a trailing newline changes the result, so nothing is trimmed. The URL-safe variant swaps + and / for - and _. The decoder accepts both alphabets, ignores spaces and line breaks, and does not require padding.
After decoding, the tool looks at the first bytes. If they are the signature of a PNG (89 50 4E 47 0D 0A 1A 0A), a JPEG (FF D8 FF), a GIF, a WebP or a PDF, the result is a file named with the matching extension. Otherwise, bytes that are valid UTF-8 are shown as text, and anything else is offered as a .bin download. A signature is evidence, not proof: a text file that happens to start with %PDF- is treated as a PDF. Base64 is an encoding, not encryption, so anyone who has the string can decode it.