Convert text with automatic Base64 and Base64URL detection
Decode from Base64
- Base64 to Text
- Base64 to MP3
- Base64 to WAV
- Base64 to PNG
- Base64 to JPG
- Base64 to File
- Base64 to Excel (XLSX)
- Base64 to Word (DOCX)
- Base64 to ZIP
- Base64 to Image
- Base64 to Audio
- Base64 to Video
- Base64 to PDF
- Base64 to Hex
- Base64 to ASCII
- Base64 to JSON
- Basic Auth Decode
Encode to Base64
- Text to Base64
- File to Base64
- Image to Base64
- Audio to Base64
- Video to Base64
- PDF to Base64
- Hex to Base64
- HTML to Base64
- CSS to Base64
- JSON to Base64
- URL to Base64
How to encode and decode Base64
- To encode, type or paste text into the Text box. The Base64 result appears in the box beside it while Convert as I type is on.
- To decode, paste a Base64 string into the Base64 box and select Decode Base64.
- Tick URL-safe (Base64URL) for tokens and URL parameters, or Process each line to convert a list one entry at a time.
- For a file, pick Encode or Decode next to Choose file, select the file, then select Download result.
- Select Copy above either box to put its content on your clipboard.
What this Base64 encoder and decoder does
This page converts in both directions from one screen. Text goes in on the left and Base64 comes out on the right, or the other way around. Text is read as UTF-8, so accented letters, Chinese, Arabic and emoji survive a round trip unchanged.
Everything runs in your browser. The text you paste and the files you choose are converted by JavaScript on your device and are not sent to a server, which matters when the value is an API key, a certificate or a customer record.
How Base64 works
Base64, defined in RFC 4648, turns arbitrary bytes into text using 64 characters: A-Z, a-z, 0-9, plus and slash. The encoder takes three bytes at a time, which is 24 bits, and splits them into four groups of 6 bits. Each group is a number from 0 to 63 and maps to one character.
When the input length is not a multiple of three, the last group is filled with zero bits and the output is padded with = so its length stays a multiple of four. One leftover byte gives two characters and ==. Two leftover bytes give three characters and =. The result is about 33% larger than the input.
Man -> TWFu
Ma -> TWE=
M -> TQ==
Hello, world! -> SGVsbG8sIHdvcmxkIQ==Base64 and Base64URL
Standard Base64 uses + and /, which have special meaning in URLs and file names. Base64URL replaces them with - and _ and usually drops the = padding. JSON Web Tokens, OAuth PKCE challenges and many signed URLs use this variant. The two bytes FB FF encode to +/8= in standard Base64 and to -_8 in Base64URL.
Tick URL-safe (Base64URL) before converting to produce or read that alphabet. The decoder is strict: a string that mixes characters from outside the selected alphabet is reported as invalid instead of being silently repaired.
Options for lists and files
The workbench has a few switches for the cases that come up most often in real work.
- Convert as I type updates the Base64 box on every keystroke. Turn it off for large inputs and use the buttons.
- Process each line treats every line as a separate value, which suits lists of IDs, tokens or config entries.
- File encoding reads any file up to 20 MiB and gives you its Base64 as a download.
- File decoding turns a Base64 text file back into the original bytes. Binary results are offered as a download because they cannot be shown as text.
Base64 in code
Most languages ship a Base64 codec. The detail that trips people up is text encoding: convert the string to UTF-8 bytes first, then encode the bytes. In browsers, btoa accepts only Latin-1 characters, so non-English text needs TextEncoder.
// JavaScript
btoa(String.fromCharCode(...new TextEncoder().encode("héllo"))) // aMOpbGxv
# Python
import base64
base64.b64encode("héllo".encode()).decode() # aMOpbGxv
# Shell
printf 'Hello, world!' | base64 # SGVsbG8sIHdvcmxkIQ==
printf 'SGVsbG8sIHdvcmxkIQ==' | base64 -dWhere Base64 is used
Base64 exists to carry binary data through channels built for text. You will find it in email attachments (MIME), data URLs that embed images in HTML and CSS, HTTP Basic Authorization headers, PEM certificates and keys, Kubernetes Secrets, JWT segments, and JSON APIs that accept images or audio for AI models.
It is an encoding and gives no secrecy. Anyone can decode a Base64 string without a key, so a Base64 password is as exposed as the plain one. Use encryption when the content must stay private.
Frequently asked questions
Is this Base64 converter free and private?
Yes. It is free to use without an account. Text and files are converted locally in your browser and are not uploaded, so the data stays on your device.
How do I decode a Base64 string?
Paste it into the Base64 box and select Decode Base64. The decoded UTF-8 text appears in the Text box. If the string uses - and _, tick URL-safe (Base64URL) first.
Why does my Base64 end with = or ==?
The equals signs are padding. They fill the last group of four characters when the input length is not a multiple of three bytes. One = means two bytes were left over, and == means one.
Why is Base64 output longer than the input?
Every three bytes become four characters, so encoded data is about 33% larger. A 3 MB file becomes roughly 4 MB of Base64 text.
Can I convert an image or PDF to Base64?
Yes. Choose Encode next to Choose file, select the file and download the result. Files up to 20 MiB are supported. The dedicated Image to Base64 and PDF to Base64 tools add data URL output.
Is Base64 encryption?
No. Base64 is a reversible encoding with no key, designed for transport and storage, not secrecy. Encrypt sensitive data before encoding it if it must remain confidential.
What does an invalid Base64 error mean?
The input has a character outside the selected alphabet, a length that cannot occur, or padding in the wrong place. Remove quotes and escape characters, and check whether the value is Base64URL.
More developer tools
Binary, hex and bitwise
Base64 essentials
Encoding and decoding
AI utilities
AI payloads and robotics
Developer and IT
Data and text
Media and files
Social and SEO
Finance and regional
Other utilities
Browse all tools 320 tools · 6 tool collections