- base64hub
- Docs
base64hub Docs
Reference for everything base64hub ships outside the website. Every product follows the same Base64 rules, so what you learn on one page holds on the others.
Pick a product
| You want to | Use | Docs |
|---|---|---|
| Encode or decode in a terminal or script | the b64 CLI | CLI |
| Call Base64 functions from Node.js | npm base64hub | npm package |
| Call Base64 functions from Python | PyPI base64hub | Python package |
| Give an AI assistant exact Base64 tools | base64hub-mcp | MCP server |
| Encode or decode in Chrome without a tab | the extension | Chrome extension |
| Make HTTP requests from any language or no-code tool | https://api.base64hub.com/v1 | HTTP API |
| Encode or decode from your phone | @base64hubbot | Telegram bot |
All of them are free and MIT-licensed, and none of them has runtime dependencies. Install commands and downloads are on the download page.
Shared rules
The products share one specification and one set of test vectors, so they agree byte for byte.
Encoding uses the standard alphabet from RFC 4648 with = padding unless you ask for the URL-safe alphabet (- and _) or for no padding. Wrapping inserts a \n after every N characters, never at the end; 76 is the MIME line length. Data URIs are never wrapped, and their MIME type is detected from the content when you do not give one: PNG, JPEG, GIF, WebP, PDF and SVG by their signatures, then text/plain;charset=utf-8 for UTF-8 text, otherwise application/octet-stream.
Decoding is lenient on purpose:
- Surrounding whitespace is trimmed, and a
data:...;base64,prefix is removed. - Spaces, tabs, CR and LF inside the text are ignored.
- Trailing
=padding is optional. More than two=, or a=anywhere else, is an error. - Both alphabets are accepted, even mixed in one string.
- Any other character is an error, and so is a length that leaves a single character in the last group of four.
- Empty input decodes to empty output.
Errors are reported left to right, with positions counted from 0 in the cleaned input. The CLI and the API word them like this:
invalid character '!' at position 4
unexpected '=' at position 2: padding is only allowed at the end
too much padding: 3 '=' at position 2, at most 2 are allowed
invalid length: 5 characters leave a single character in the last group
Validation succeeds exactly when decoding would. It also reports the variant (standard if + or / occurs, url if - or _ occurs, mixed if both, either if neither), whether the input is padded to a multiple of four, and the decoded size in bytes.
Where only text can be shown, as in API JSON, MCP results and the bot, decoded bytes that are not valid UTF-8 are given as hex instead of garbled characters.
The website itself
The tools on base64hub.com run in your browser and never call the API: a Content Security Policy blocks every request except anonymous page-view counts. The code samples in these docs are there to copy; nothing on these pages sends requests to the API.
Updated Nov 22, 2026