# Base64 encode and decode > How do you turn text or a file into Base64? Encode text or a file to Base64 and decode it back, right in your browser. Encode text or a file to Base64 and decode Base64 back to text or a file. Standard or URL-safe alphabet, any language, and nothing leaves your device. - Page: https://how.box/base64/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/base64/?dir={dir}&text={text}&url={url}&pad={pad} - `dir` (encode or decode): encode or decode. Example: `encode`. - `text` (text): The text to encode, or the Base64 to decode. Example: `Hello, world!`. - `url` (boolean): URL-safe alphabet when encoding: 1 or 0. Example: `false`. - `pad` (boolean): End with = padding when encoding: 1 or 0. Example: `true`. Example answer: https://how.box/base64/?dir=encode&text=Hello%2C+world%21&url=0&pad=1 The page computes the answer in the browser: read results from the agent tools below, not from the page HTML. ## Agent tools - `base64_convert`: Converts text to Base64 or Base64 to text, as in RFC 4648 (standard alphabet, or the URL-safe one of §5), reading and writing text as UTF-8. - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"base64_convert","arguments":{"direction":"encode","text":"Hello, world!","url_safe":false,"padding":true}}}` - GET: https://how.box/mcp/run/base64_convert?direction=encode&text=Hello%2C+world%21&url_safe=false&padding=true ## How it works Base64 writes any data, including a picture or a file, using only 64 safe characters: the letters, the digits, plus and slash. That lets binary data travel through places that only handle text, such as email, JSON or a web address. It is a way of writing data, not a way of hiding it: anyone can decode it. The data is cut into groups of three bytes (24 bits), and each group is written as four characters of six bits each. So Base64 is a third longer than the original, and a final group of one or two bytes is topped up with = signs. For example the text Man becomes TWFu, and f becomes Zg== (RFC 4648). Text is first turned into bytes as UTF-8, so every language and emoji works. The URL-safe variant swaps + and / for - and _, so the result needs no escaping in an address or file name, and often leaves out the = padding. When decoding, this tool reads both kinds, ignores spaces and line breaks, and rejects anything else. Files up to 5 MB are read and converted in your browser; nothing is uploaded. ## FAQ **Is Base64 encryption?** No. Anyone can decode it, so never use it to protect a password or a secret. It only makes data safe to carry as text. **Why is the result longer than the original?** Every three bytes become four characters, so the result is about a third larger. The extra size is the price of using only safe characters. **Why does decoding say the data is not text?** Base64 can hold any file, not just text. If the decoded bytes are not valid UTF-8 text, such as an image, download them as a file instead. **Can I decode Base64 without the equals signs?** Yes. This decoder accepts missing padding when the remaining length is valid. **Does Base64 preserve accented letters and emoji?** Yes. Text is encoded as UTF-8 bytes, so those characters round-trip when decoded as UTF-8. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)