How to encode or decode Base64
- 1Choose Encode or Decode with the buttons at the top.
- 2On the Text tab, type or paste your input. To encode a file, switch to the File tab and drop the file onto the drop zone; it is read as raw bytes and encoded right away.
- 3For text, click Encode or Decode to run the conversion. Turn on URL Safe first if the encoded value is going into a URL, a filename or a JWT.
- 4If the decoded data is a PNG, JPEG, GIF or WebP image, the output panel shows a preview with its dimensions and a Download Decoded File button. Otherwise the decoded text appears in the output.
- 5Click Copy, or Save as File to download the result as a .txt file.
What Base64 is and when to use it
Base64 is a way to represent arbitrary binary data using only 64 safe, printable ASCII characters: A-Z, a-z, 0-9, + and /. The encoder takes the input three bytes (24 bits) at a time and splits them into four 6-bit groups, each of which maps to one character. When the input isn't a multiple of three bytes, the output is padded with one or two = signs. The result is always about 33% larger than the original.
It exists because many systems were built to carry text, not bytes. Email attachments (MIME), data: URIs in HTML and CSS, binary fields in JSON or XML, HTTP Basic authentication headers and PEM certificates all use Base64 to move binary data through a text-only channel without it being mangled by character set conversions or line-ending changes.
Base64 is not encryption and not compression. There is no key, and anyone can decode it in one line of code, so never treat a Base64 string as hidden. It also only works on bytes, which is why text has to be turned into bytes first. This Base64 encoder treats text as UTF-8, so emoji and non-Latin scripts round-trip correctly, whereas the browser's built-in btoa() throws on any character outside Latin-1.
Standard Base64 uses + and /, which have special meaning in URLs and file paths. The URL-safe variant from RFC 4648 swaps them for - and _ and usually drops the = padding. It's what JWTs, many OAuth parameters and signed URLs use. The decoder here accepts either alphabet and fixes missing padding, so you can paste a JWT segment straight in.
When developers reach for it
Inspecting encoded API fields
Decode a Base64 field from an API response or a Kubernetes Secret to see the actual value.
Embedding small files
Encode an icon or font to Base64 so you can inline it in CSS, HTML or a JSON fixture.
Building auth headers
Encode user:password for an HTTP Basic Authorization header while testing an endpoint.
Converting Base64 to image files
Paste Base64 from a log or database column and see whether it's a PNG, JPEG, GIF or WebP image, with its size and dimensions.
Frequently asked questions
Is Base64 encryption?
+
No. Base64 is an encoding with no key or secret, and anyone can reverse it instantly. Use real encryption if the data needs to be protected.
Why is the Base64 output bigger than my input?
+
Every 3 bytes of input become 4 characters of output, so encoded data is roughly 33% larger, plus up to two = padding characters.
What is URL-safe Base64?
+
It's the RFC 4648 variant that uses - and _ instead of + and /, and drops the = padding, so the value can sit in a URL or filename without escaping. JWTs use it for all three segments. Turn on URL Safe to Base64URL encode text or a file.
Can I decode a data URI like data:image/png;base64,...?
+
Paste only the part after the comma. The decoder expects raw Base64, and the data: prefix contains characters that aren't part of the Base64 alphabet.
Can I decode Base64 back into an image?
+
Yes. When the decoded bytes start with a PNG, JPEG, GIF or WebP signature, the tool shows a preview with the image dimensions and lets you download the file.
How do I Base64 encode a file?
+
Switch to the File tab and drop the file onto the drop zone. It's read as raw bytes and encoded immediately, so images, PDFs and other binary files work, not just text.
Does the Base64 converter handle emoji and non-English text?
+
Yes. Text is converted to UTF-8 bytes before encoding, and decoding Base64 to text reads the bytes back as UTF-8, so emoji, accented letters and CJK characters come back exactly as you typed them.
Is it safe to use a Base64 decoder online?
+
It depends on where the decoding happens. Here it runs in your browser, and files are read with the FileReader API, so nothing is sent to a server. That matters when the string is a Kubernetes Secret or a Basic auth header.
Related tools
Base64 to Image Decoder
Paste a Base64 string or data URI and see the image instantly. Detects PNG, JPEG, GIF, WebP, SVG, BMP, ICO and AVIF, then downloads it with the right extension.
Image to Base64
Encode any image as a base64 data URL. Copy as raw string, CSS background, HTML img tag, or Markdown — perfect for inlining icons and small assets.
URL Encoder & Decoder
Encode or decode URLs and URI components instantly. Supports encodeURIComponent for query parameters and encodeURI for full URLs.
JWT Decoder
Decode and inspect JWT tokens instantly. View header, payload, signature, expiration status, and time claims.