Free online Base64 encoder & decoder. Instantly convert text to/from Base64. No signup.
Paste any text in the input box and click Base64 Encode to convert it instantly. Paste a Base64 string and click Base64 Decode to reverse the conversion. All processing runs locally in your browser — no data is sent to any server.
Base64 is a binary-to-text encoding scheme defined in RFC 4648. It represents binary data using a set of 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /. Every 3 bytes of input are mapped to 4 Base64 characters, making the output approximately 33% larger than the original.
Base64 is not encryption — it is trivially reversible without any key. Its purpose is to represent binary data as text so it can pass safely through text-only protocols (email, JSON, HTTP headers).
data:image/png;base64,... URIs, eliminating extra HTTP requests for small assets.+ with - and / with _).Authorization: Basic ... header contains credentials as username:password Base64-encoded.// Encode
const encoded = btoa('Hello, World!'); // "SGVsbG8sIFdvcmxkIQ=="
// Decode
const decoded = atob('SGVsbG8sIFdvcmxkIQ=='); // "Hello, World!"
// Unicode-safe encode (handles non-ASCII)
const bytes = new TextEncoder().encode(str);
const bin = Array.from(bytes, b => String.fromCharCode(b)).join('');
const b64 = btoa(bin);
// Base64url (for JWTs)
const b64url = btoa(str).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'');
import base64
# Encode
encoded = base64.b64encode(b'Hello, World!').decode() # "SGVsbG8sIFdvcmxkIQ=="
# Decode
decoded = base64.b64decode('SGVsbG8sIFdvcmxkIQ==').decode('utf-8')
# URL-safe Base64 (no + or /)
safe = base64.urlsafe_b64encode(b'Hello').decode()
# HTTP Basic Auth uses Base64
curl -H "Authorization: Basic $(echo -n 'user:pass' | base64)" \
https://api.example.com/
= characters are appended to make the output length a multiple of 4.+ with - and / with _, and typically omits = padding. JWT tokens use Base64url for their header and payload segments.base64.b64encode(open('img.png','rb').read()).decode(). In JavaScript (browser): use a FileReader with readAsDataURL() which returns a complete data URI including the Base64 payload.btoa() expects a binary string (characters 0–255). For Unicode text, encode it with TextEncoder to get bytes first, then convert to a binary string before calling btoa(). This tool handles that automatically.