Base64 / URL / HTML Encoder-Decoder
Encode and decode Base64, URLs, HTML entities, JWT tokens, and hex — all in your browser.
Understanding Encoding Formats
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It is widely used to embed binary data in text-based formats like JSON, XML, HTML, and email (MIME). Common use cases include embedding images in CSS/HTML as data URIs, transmitting binary data over APIs, and encoding authentication credentials in HTTP Basic Auth headers.
URL encoding (percent-encoding) replaces unsafe ASCII characters with a “%” followed by two hexadecimal digits. This ensures special characters like spaces, ampersands, and equals signs don’t break URL structure. Every web developer encounters URL encoding when working with query parameters, form submissions, or deep linking.
HTML entity encoding converts characters that have special meaning in HTML (like <, >, &) into their entity equivalents. This prevents XSS (cross-site scripting) vulnerabilities and ensures proper rendering of content in web pages.
JWT (JSON Web Tokens) are a compact, URL-safe means of representing claims between two parties. They consist of three Base64url-encoded parts separated by dots: header, payload, and signature. JWTs are the dominant authentication token format for modern web APIs and Single Sign-On systems.
Hexadecimal encoding represents each byte as two hex digits (0-9, a-f). It is commonly used in debugging, cryptography (hash outputs, keys), color codes, and low-level data inspection.
How to Use This Tool
- Select a tab — Choose from Base64, URL, HTML, JWT, or Hex encoding.
- Choose direction — Toggle between Encode and Decode (except for JWT, which is decode-only).
- Enter your input — Paste or type your data into the input field.
- Process — Click the button or press Ctrl+Enter to encode/decode.
- Copy result — Click “Copy” to copy the output to your clipboard.
All processing is performed locally in your browser. No data is sent to any server.
Frequently Asked Questions
Is Base64 encoding the same as encryption?
No. Base64 is an encoding scheme, not encryption. Anyone can decode Base64 data without a key. It is meant for data transport safety, not security. For confidentiality, use proper encryption algorithms like AES-256 before Base64-encoding the ciphertext.
Why is my Base64 output 33% larger than the input?
Base64 converts every 3 bytes of input into 4 ASCII characters, resulting in approximately 33% size overhead. This is the unavoidable trade-off for representing binary data safely in text-based protocols.
Can I decode a JWT without the secret key?
Yes, the header and payload of a JWT are Base64url-encoded (not encrypted) and can be decoded by anyone who has the token. However, you cannot verify or forge the signature without the secret key. This is why JWTs provide integrity guarantees, not confidentiality.
Is my data sent to a server?
No. All encoding and decoding operations run entirely in your browser using JavaScript. Your data never leaves your device.
What is the difference between Base64 and Base64url?
Standard Base64 uses + and / characters. Base64url (URL-safe Base64) replaces + with - and / with _ so the result can be safely used in URLs and HTTP headers without percent-encoding. JWT tokens use Base64url. Most API contexts requiring Base64 in URLs also expect Base64url.
How do I encode an image as a Base64 data URL?
Read the image file as bytes, Base64-encode the bytes, then prefix with data:[mimeType];base64,. For example: data:image/png;base64,iVBORw0KGgo.... You can then use this string directly as the src attribute of an HTML <img> tag. Note data URLs increase HTML file size by 33%.
What does the = padding at the end of Base64 mean?
The = characters are padding added to make the Base64 output length a multiple of 4. One = means 1 byte of padding was added; == means 2 bytes. Some systems (like JWT) omit padding and expect parsers to infer it from string length.
Can I use Base64 in XML, like in XRechnung attachments?
Yes. XRechnung supports embedded attachments via the AdditionalDocumentReference element. Binary files (PDFs, images) must be Base64-encoded when embedded in the XML. Our encoder produces standard Base64 suitable for embedding in XML documents.
What character encoding should I use before Base64-encoding text?
Always encode your text string as UTF-8 bytes before applying Base64. Using other encodings (Latin-1, UTF-16) will produce correct Base64 but the recipient must know which encoding was used to decode correctly. UTF-8 is the universal standard for text-based APIs.