Base64 Encode
Encode Text or Data as Base64 for Transport and Storage
Use this Base64 encoder to turn text or binary-like data into a Base64 string for APIs, logs, and transport. Base64 keeps data safe in text-only channels and is fully reversible.
- Paste the text or data you want to encode.
- Click "Encode" to generate the Base64 string.
- Copy the output and use it in your app, API, or config file.
Base64 encoding maps bytes to a 64-character alphabet (A-Z, a-z, 0-9, +, /). It is not encryption; it is a reversible encoding used for safe transport through text-only systems.
This encoder is useful when you need to:
- Prepare payloads: Send data through JSON, query strings, headers, or logs.
- Embed assets: Include small files in config values or data URIs.
- Preserve bytes: Keep binary data intact in text-only pipelines.
Use the Base64 Decode tool to reverse your output back into readable text or bytes. Together, the encoder and decoder make it easy to move between encoded and decoded forms.
In Python, use the built-in base64 module:
import base64
text = "Hello, World!"
encoded_bytes = base64.b64encode(text.encode("utf-8"))
encoded_str = encoded_bytes.decode("utf-8")
print(encoded_str) # Outputs: SGVsbG8sIFdvcmxkIQ==In JavaScript, use the btoa() function for ASCII input:
const text = "Hello, World!";
const encoded = btoa(text);
console.log(encoded); // Outputs: SGVsbG8sIFdvcmxkIQ==Encode data from the terminal:
# Encode a string
printf '%s' "hello" | base64
# Encode a file
base64 ./file.bin > file.b64The encoder accepts plain text and structured data such as JSON, YAML, or XML. For binary files, convert to bytes first and then encode.
What is Base64 encoding?
Base64 encoding represents binary or text data using 64 ASCII characters. It is reversible and not encryption.
When should Base64 encoding be used?
Use Base64 when data must travel through text-only systems such as JSON payloads, query strings, headers, email, or log files.
Does this tool store my data?
No. Encoding is performed in the browser and input is not stored on the server.