Codificação/Decodificação Base64
Free online Base64 encode and decode tool. Supports text conversion, file upload to Data URI, and URL Safe mode. All processing is done in your browser — your data never leaves your device.
Input Text
Base64 Result
What is Base64?
Base64 is an encoding method that uses 64 printable characters to represent binary data. Since 2⁶=64, every 6 bits form a unit mapped to one printable character. Base64 is commonly used to transmit binary data in text-based protocols, such as Data URI in HTML/CSS and HTTP Basic Auth tokens.
How It Works
During encoding, every 3 bytes (24 bits) are split into 4 groups of 6 bits each, mapped to a Base64 table character. If data is less than 3 bytes, = padding is used. Decoding reverses this process, converting each Base64 character back to 6 bits and reassembling the original data.
Base64 Encoding Notes:
- Encoded data is about 33% larger than original (3 bytes → 4 chars)
- Printable characters:
A-Z,a-z,0-9,+,/ - May include 1 or 2
=padding characters at the end - Fully reversible encoding (not encryption)
Common Use Cases
- Data URI — Embed images, fonts and other binaries directly in HTML/CSS
- HTTP Basic Auth — Username and password transmitted via Base64 encoding
- JWT Token — Header and Payload of JSON Web Tokens use Base64 URL Safe encoding
- API Token — Many API keys use Base64 encoding for storage and transmission
- Email Attachments — MIME protocol uses Base64 for binary attachment transfer
Base64 Encoding Table
| 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 | / |
+ becomes -, / becomes _, and trailing = is removed, making the result directly usable in URLs without additional encoding.