Base64 Encoder/Decoder
Convert text to Base64 encoding or decode Base64 to text with this easy-to-use tool.
Examples
Example 1: Basic Text Encoding
Original Text: Hello World
Base64 Encoded: SGVsbG8gV29ybGQ=
Example 2: Special Characters
Original Text: Special @#$% characters!
Base64 Encoded: U3BlY2lhbCBAIyQlIGNoYXJhY3RlcnMh
Example 3: URL-Safe Encoding
Original Text: URL+Safe/Encoding
Standard Base64: VVJMK1NhZmUvRW5jb2Rpbmc=
URL-safe Base64: VVJMK1NhZmUvRW5jb2Rpbmc=
URL-safe Base64: VVJMK1NhZmUvRW5jb2Rpbmc=
About Base64 Encoding
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding.
How Base64 Works
Base64 encoding converts binary data into a set of 64 characters (A-Z, a-z, 0-9, + and /) that can be safely transmitted over text-based protocols. The process works as follows:
- Each three bytes (24 bits) of binary data are divided into four 6-bit groups
- Each 6-bit group is converted to a character from the Base64 character set
- If the input length is not divisible by 3, padding characters (=) are added to make the output length a multiple of 4
Common Uses of Base64
- Email Attachments: MIME uses Base64 to encode binary attachments
- Data URIs: Embedding images directly in HTML or CSS
- API Communication: Safely transmitting binary data in JSON
- Cookies and Web Storage: Storing complex data structures
- Basic Authentication: Encoding username and password pairs
URL-Safe Base64
Standard Base64 uses the characters + and / which have special meanings in URLs. URL-safe Base64 replaces these with - and _ respectively, making the encoded strings safe for use in URLs without additional encoding.
Note: Base64 encoding increases the data size by approximately 33% (4 characters for every 3 bytes of data), making it less efficient for storage but more reliable for transmission.
Tool Features
- Encode Text to Base64: Convert any text or string to Base64 format
- Decode Base64 to Text: Convert Base64 encoded data back to plain text
- URL-Safe Encoding/Decoding: Support for URL-safe Base64 variant
- Auto-Detection: Automatically detect standard or URL-safe encoding
- Copy to Clipboard: One-click copying of results
- Download Results: Save encoded or decoded output as a file
Base64 Character Set
| Value | Char | Value | Char | Value | Char | Value | Char |
|---|---|---|---|---|---|---|---|
| 0 | A | 16 | Q | 32 | g | 48 | w |
| 1 | B | 17 | R | 33 | h | 49 | x |
| 2 | C | 18 | S | 34 | i | 50 | y |
| 3 | D | 19 | T | 35 | j | 51 | z |
| 4 | E | 20 | U | 36 | k | 52 | 0 |
| 5 | F | 21 | V | 37 | l | 53 | 1 |
| 6 | G | 22 | W | 38 | m | 54 | 2 |
| 7 | H | 23 | X | 39 | n | 55 | 3 |
| 8 | I | 24 | Y | 40 | o | 56 | 4 |
| 9 | J | 25 | Z | 41 | p | 57 | 5 |
| 10 | K | 26 | a | 42 | q | 58 | 6 |
| 11 | L | 27 | b | 43 | r | 59 | 7 |
| 12 | M | 28 | c | 44 | s | 60 | 8 |
| 13 | N | 29 | d | 45 | t | 61 | 9 |
| 14 | O | 30 | e | 46 | u | 62 | + |
| 15 | P | 31 | f | 47 | v | 63 | / |
URL-safe variant: + is replaced with - and / is replaced with _