base64-lite
Free tool that encodes or decodes Base64 for text and local files. Optional URL-safe alphabet and data-URI output.
Need it at scale in the cloud? The pay-per-use Base64 Encoder & Decoder on Apify costs $0.001 per unique item. Failed items are free.
Plain code, not AI, so the same input always gives the same output. Runs on your own computer. MIT license. Works with Python 3.10 and newer, on Windows, Mac and Linux.
Also searched as: ES: codificar base64, decodificar base64 / PT: codificar base64 / DE: Base64 kodieren / FR: encoder en base64 / JA: Base64エンコード、Base64デコード
Links
- Website — product page with prices and options
- Apify (no-install cloud version) — $0.001 per unique item, failed items free
Before and after
Before (plain text):
hello world
After (Base64):
aGVsbG8gd29ybGQ=
Decode works the other way, including data URIs like data:text/plain;base64,aGVsbG8gd29ybGQ=.
Install
pip install git+https://github.com/tidybytetools/base64-lite
Or use pipx, which keeps it in its own space:
pipx install git+https://github.com/tidybytetools/base64-lite
Or just download base64_lite.py and run it with python3. That one file uses only Python's standard library. (Installing with pip also adds the mcp package, which the MCP server needs.)
Use it
printf 'hello world' | base64-lite --action encode
base64-lite photo.png --action encode --data-uri
printf 'aGVsbG8gd29ybGQ=' | base64-lite --action decode
base64-lite note.b64 --action decode
base64-lite file.bin --action decode --output out.bin # when the bytes are not text
printf 'hello world' | base64-lite --json # {"ok": true, "action": "encode", "base64": "..."}
--action auto (the default) decodes if the input looks like Base64, otherwise it encodes. Use --action encode or --action decode when you already know the direction. --url-safe uses - and _ instead of + and / when encoding. Decoding always accepts both forms.
From Python:
from base64_lite import convert
convert("hello world", None, action="encode")["base64"] # 'aGVsbG8gd29ybGQ='
When you run it in a terminal it prints one short line about the Apify version to stderr after the result. It never goes into your output, it only shows when you are looking at a terminal, and --quiet turns it off.
Known limits
autocan guess wrong on short or unusual strings. Useencodeordecodewhen you already know the direction.- Local files only. This free tool does not fetch file links from the internet. The Apify version does.
- 5 MB cap in the MCP file tool. The command line will read a larger local file, but very large jobs are a better fit for Apify.
- It does not inspect decoded bytes for viruses or hidden data.
Lite vs Apify
| lite (free, this repo) | Apify cloud version | |
|---|---|---|
| Encode and decode text or files | yes, on your computer | yes, in the cloud |
| URL-safe alphabet and data URIs | yes | yes |
| Fetch file links | no | yes |
| Many items in one run | you can loop on your own | yes, and repeats in the same run are free |
| MCP server for local AI apps | yes | use Apify MCP for the cloud tool |
| Price | free | $0.001 per unique item. Failed items are free |
Use it from Claude Desktop or Cursor (MCP)
There is a small free MCP server built in. It gives your AI app two tools. Both only read. They never write or change files, and they never use the internet. It needs uv.
Run it by hand to check it starts (it waits quietly for an app to talk to it):
uvx --from git+https://github.com/tidybytetools/base64-lite base64-lite mcp
Claude Desktop (claude_desktop_config.json) or Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"base64-lite": {
"command": "uvx",
"args": ["--from", "git+https://github.com/tidybytetools/base64-lite", "base64-lite", "mcp"]
}
}
}
uvx --from git+https://github.com/tidybytetools/base64-lite base64-lite-mcp starts the same server.
Tools:
convert_text(text, action="auto", url_safe=false, data_uri=false): for text or Base64 in the chat.convert_file(path, action="auto", url_safe=false, data_uri=false): for a local file, up to 5 MB. For decode, the file must be UTF-8 text of Base64.
Encoded results include base64 (and dataUri if you asked). Decoded results include text when the bytes are UTF-8, or isText false if they are not.
For AI agents
- Use when: you need to encode text or a local file to Base64, or decode Base64 / a data URI.
- Don't use when: you need to fetch a file from a URL, or the file is bigger than 5 MB in MCP. Use the Apify version for those jobs.
- Input: text on stdin or a file path. Optional
--action auto|encode|decode,--url-safe,--data-uri,--output FILE. - MCP:
uvx --from git+https://github.com/tidybytetools/base64-lite base64-lite mcpgives two read-only tools,convert_textandconvert_file. - Output: with
--json, one object such as{"ok": true, "action": "encode", "base64": "...", "bytesIn": 11}. On errorokis false. Exit code 0 ok, 1 error. - Hint lines go to stderr only, and only in a terminal, so stdout is always clean. See also
llms.txt.
Tests
pip install "mcp>=1.10,<2"
python3 -m unittest discover tests
The MCP tests are skipped if mcp is not installed.
FAQ
What input does it take?
Text on stdin, or a local file. Use --action encode or --action decode if you already know the direction.
Do my files leave my computer? No. The tool runs on your computer and never uses the internet.
How is this different from the Apify version? The Apify version runs in the cloud, can fetch file links, and can process many items in one run ($0.001 per unique item, failed items free). This lite tool is free and local.
Does it work with AI apps? Yes. It includes a free MCP server. No API key.
License
MIT. See LICENSE.
Metadata
Release files for base64-lite 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| base64_lite-1.0.1.tar.gz | 12.6 kB | With provenance | Details for base64_lite-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| base64_lite-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for base64_lite-1.0.1-py3-none-any.whl |
Total release size: 22.7 kB
Release files / base64_lite-1.0.1.tar.gz
| Download URL | base64_lite-1.0.1.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
123bcce7728fd7e7cb93b2bb66381693f7f8b1e401a9d176a6705baf3c51f2c2
|
|
BLAKE2b-256 checksum How to use checksums |
16e85eb0e4a6a3c81b9980e30ae3dc115f3f1a5871398f595f19bba68fc9419b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / base64_lite-1.0.1-py3-none-any.whl
| Download URL | base64_lite-1.0.1-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2e10b1425285c82c93079a847d76e8c9d24c6d305bcb138894062d79719ff52
|
|
BLAKE2b-256 checksum How to use checksums |
a0da5c3bb283dfe3217a3d9005afc15f2f88f478596c264a841a3bb1af6cc115
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logSecurity for base64-lite 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for base64_lite-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.