About this tool
Encode strings to Base64 or decode Base64 back to text.
Base64 is an encoding scheme that represents binary data as printable ASCII characters using a 64-character alphabet. It is widely used for embedding images in HTML/CSS (data URIs), encoding JWT tokens, sending binary data in JSON APIs, and storing binary values in text fields. The raw.tools Base64 tool encodes and decodes instantly with a URL-safe variant (replacing +/ with -_) also supported.
Example
Encode Hello, World! → SGVsbG8sIFdvcmxkIQ==
Decode SGVsbG8sIFdvcmxkIQ== → Hello, World!
How to use
- Type or paste text in the input field.
- Click Encode to get the Base64 string.
- Or paste Base64 and click Decode.
- Copy the result.
Features
- Text → Base64 and Base64 → text
- URL-safe Base64 variant
- Auto-detect mode
- UTF-8 support
- One-click copy
When to use this
Frontend developers embedding small images directly in CSS as data URLs (data:image/png;base64,...) to eliminate HTTP requests.
Developers inspecting HTTP Basic Authorization headers — the credentials are Base64-encoded and can be decoded to verify correctness.
Email developers checking MIME attachment encoding, where binary attachments are Base64-encoded for transmission as text.
Backend developers encoding binary config values (keys, certificates) received from APIs before storing them as strings.
Frequently Asked Questions
What is Base64 used for?+
Embedding images as data URIs in CSS, encoding JWT tokens, MIME email attachments, and storing binary values in JSON or XML where only ASCII is safe.
Is Base64 encryption?+
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string — it provides no security or confidentiality.
What is URL-safe Base64?+
Standard Base64 uses + and / which are special in URLs. URL-safe Base64 replaces them with - and _ so the string can be used in URLs without percent-encoding.
Does it handle Unicode text?+
Yes. Text is first encoded to UTF-8 bytes, then those bytes are Base64-encoded — so all Unicode characters work correctly.
Can I encode binary files, not just text?+
Base64 is designed for binary data. Paste the raw bytes (or a data URI from a file input) to encode binary. Text encoded as UTF-8 bytes works the same way.
What does the == padding at the end mean?+
Base64 output length must be a multiple of 4. == or = padding characters are added when the input length is not divisible by 3. They are part of the standard and must be kept.
Why do some Base64 strings use - and _ instead of + and /?+
URL-safe Base64 replaces + with - and / with _ to avoid conflicts with URL syntax. Use URL-safe mode when embedding Base64 in a URL or cookie.