What is base64 encoder and decoder?
Base64 is used to carry binary data inside text based systems, such as emails, JSON and data URLs. It makes data about one third larger.
This tool supports Unicode text, so accented letters and emoji encode and decode correctly.
How to use the base64 encoder and decoder
- Pick encode or decode.
- Paste your input.
- Press Calculate and copy the output.
How the base64 encoder and decoder works
Text is converted to UTF 8 bytes and the bytes are mapped to the 64 character Base64 alphabet in groups of three, with equals signs added as padding.
Worked example
Common uses of the base64 encoder and decoder
- Embedding a small image or font directly in CSS or HTML.
- Reading the payload of a token or an email header while debugging.
- Sending binary data inside JSON or XML.
- Decoding a Base64 string copied from a log.
- Learning how binary to text encoding works.
Tips and common mistakes
Base64 is not encryption. Anyone can decode it, so never use it to hide secrets.
URL safe Base64 swaps plus and slash for minus and underscore. Replace them before decoding if needed.
Background: what to know before you rely on it
Many older protocols, such as email, were designed for plain text. Base64 solves the problem of sending binary files through them by using only 64 safe characters: capital and lowercase letters, digits, plus and slash. Every three bytes become four characters, so data grows by about a third. The equals sign at the end pads the last block. A URL safe variant swaps plus and slash for minus and underscore. Base64 is an encoding and not encryption. Anyone can decode it, so passwords and secrets must never be protected by it alone.
Private, free and fast
This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.
Field by field guide
- Action: Choose one of: Encode to Base64; Decode from Base64.
- Input: Type or paste your text here. Use a new line for each entry where the label says so.
Change one field at a time to see how the result responds, and use the worked example above to check that you get the same answer.
Frequently asked questions
What is Base64?
A way to represent binary data using 64 printable characters.
Is Base64 secure?
No, it only changes the format.
Why does decoding fail?
The input may contain characters outside the Base64 alphabet or be cut short.
Guides that go with this tool
Related tools
Text to Binary Converter
Type text to get its binary or hexadecimal code, or paste binary or hex to read the text. It uses UTF8,...
Developer ToolsJSON Formatter and Validator
Paste your JSON and the tool checks that it is valid, then formats it with indentation or compresses it...
Developer ToolsURL Encoder and Decoder
URL encoding replaces unsafe characters with a percent sign and two hex digits so a link works...
Developer ToolsHash Generator
A hash is a fixed length fingerprint of your text. Enter text to get its SHA 1, SHA 256, SHA 384 and SHA...
Developer ToolsRegex Tester
Enter a pattern, flags and test text. The tester lists every match with its position and capture groups...
Developer ToolsCSS Minifier
Paste your CSS and the minifier removes comments and extra whitespace to make the file smaller, with the...
More free tools people use next
- Percentage Calculator: Use it for three jobs: find a percentage of a number, find what percent one number is of...
- UUID Generator: A UUID is a 128 bit identifier written as 32 hexadecimal digits in five groups. This tool...
- Fuel Cost Calculator: Divide the distance by your fuel economy to find how much fuel you need, then multiply by...
- HTML Minifier: Paste your HTML and the minifier removes comments and extra whitespace between tags to...
- SVG Optimizer: Paste your SVG code and the optimizer strips comments, metadata and editor leftovers and...
- Unix Timestamp Converter: A Unix timestamp counts the seconds since 1 January 1970 UTC. Paste a timestamp to see...
- JSON to CSV Converter: Paste a JSON array of objects to get CSV rows with a header, or paste CSV to get JSON....
- JWT Decoder: Paste a JWT to see its header, payload, algorithm and expiry time. The tool decodes only...
- JSON Minifier: Paste JSON to remove all extra spaces and line breaks. The tool validates the data first...
- JavaScript Minifier: Paste JavaScript to strip comments and extra whitespace. It is a safe minifier that does...
- CSS Gradient Generator: Choose two colors, a gradient type and an angle. The tool shows a live preview and gives...
- CSS Box Shadow Generator: Set the offsets, blur, spread, color and opacity to see the shadow on a preview card,...
- Subnet Calculator: Enter an IPv4 address and a prefix length such as 24. The calculator returns the network,...
- Black Screen and Screen Color Test: Pick a color and press Start. The page fills your screen with that color. Press Escape to...
- Matrix Calculator: Type matrix A (and matrix B if needed) with one row per line and spaces between numbers....
- Password Strength Checker: Type a password to see a strength rating, estimated entropy in bits and a rough crack...
- Email Address Validator: Paste one or more email addresses. The tool checks the format, flags common domain typos...
- CSS Formatter: Paste your CSS, choose an indent style and press Format. You get readable CSS with each...
- HTML Formatter: Paste your HTML and press Format. Each tag is placed on its own line with nested elements...
- SQL Formatter: Paste your SQL and press Format. Keywords become uppercase, and each clause starts on its...
- Internet Speed Test: Press Start test. The tool measures ping and jitter, then downloads and uploads data to...
Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.