Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 strings with URL-safe support.
Encodes text to Base64 and decodes Base64 back to text, including the URL-safe variant used in tokens and web addresses. Everything runs in your browser; nothing you paste is sent anywhere.
Options
- Mode — Encode or Decode.
- Trim input — when encoding, ignores spaces and line breaks at the start and end; on by default.
- URL-safe Base64 — uses
-and_instead of+and/, so the result fits in URLs, file names and JSON Web Tokens. Decoding reads both alphabets without it. - Remove padding (=) — drops the trailing
=signs, as JWTs and many URLs do. Decoding accepts Base64 with or without padding. - Wrap lines — breaks the output into lines of 20 to 120 characters; 76 is the MIME email standard. Decoding ignores spaces and line breaks.
How it works
Text is converted to UTF-8 bytes, so accented letters, other scripts and emoji encode correctly. Every 3 bytes become 4 characters from a 64-character alphabet, which makes Base64 about a third longer than the original; = pads the end to a multiple of four.
Base64 is an encoding, not encryption: anyone can decode it. Decoded bytes that form valid UTF-8 are shown as text; anything else, such as an image, is shown in hex with a button to download the file.
Examples
Decoding
- Base64
- Q29ybmVyVG9vbHM=
- Decoded
- CornerTools
Binary data
- Base64
- iVBORw0KGgo=
- Bytes
- 89 50 4e 47 0d 0a 1a 0a
These eight bytes open every PNG image. They are not valid UTF-8, so the tool shows them in hex and offers the file for download.
The variants side by side
| Variant | Result |
|---|---|
| Standard | SGk/IENhZsOpIOKYlQ== |
| URL-safe | SGk_IENhZsOpIOKYlQ== |
| URL-safe, no padding | SGk_IENhZsOpIOKYlQ |
See also
- JWT Decoder — to read the Base64URL-encoded parts of a token.
- URL Encoder & Decoder — for percent-encoding text in URLs.