Base64 Encode & Decode
Koduj tekst lub pliki do Base64 i dekoduj Base64 z powrotem, bezpiecznie dla UTF-8. Wszystko działa lokalnie — nic nie jest wysyłane.
- Wejście
- Text · any file · Base64
- Wyjście
- Base64 · Base64URL · text · file
Text
pane.characters · 50 B
Base64
pane.characters · +36% vs UTF-8 bytes
SGVsbG8sIHdvcmxkISBIw6lsbG8sIHfDtnJsZCEg44GT44KT44Gr44Gh44GvIPCfkYs=
Base64 encoding and decoding, for text and for files
This Base64 encoder and decoder turns text or any file into Base64 and back again as you type. Text is encoded as UTF-8 first, so accents, emoji and non-Latin scripts survive the round trip, and the URL-safe Base64URL variant is one click away. Everything happens in your browser: the text you paste and the files you drop are never uploaded.
How to encode or decode Base64
- Choose Text to work with something you can type or paste, or File to encode a file or turn a Base64 string back into one.
- Pick Encode or Decode. If you paste Base64 while encoding, the tool notices and offers to decode it instead.
- When encoding, choose Standard or URL-safe Base64, whether to keep the
=padding, and whether to wrap lines at 76 characters. - Copy the result, swap it back into the input to reverse the operation, or send it on to another tool. Decoded files can be downloaded; the extension is picked from the file's own signature.
What Base64 is, and why it exists
Base64 represents arbitrary bytes using only 64 safe characters: A–Z, a–z, 0–9, + and /. Every three bytes of input become four characters of output, and when the input length is not a multiple of three, one or two = signs pad the end.
It exists because many channels were built for text, not binary data. Email (MIME), JSON, XML, HTML attributes, HTTP headers and environment variables can all carry Base64 safely where raw bytes would be mangled. That is why you meet it in email attachments, data: URIs, Basic authentication headers, JSON Web Tokens and API payloads that embed files.
Base64 is an encoding, not encryption. Anyone can decode it, so it hides nothing; if a value needs to stay secret, encrypt it. If you need to check that data has not changed, a checksum from the hash generator is the right tool.
Standard Base64, Base64URL and line wrapping
The decoder accepts all of these: either alphabet, with or without padding, with or without line breaks and spaces. A full data:…;base64, URI can be pasted as it is.
- Standard (RFC 4648)
- Uses + and / and pads with =. This is what MIME, data URIs, most libraries and the base64 command-line tool produce.
- URL-safe, Base64URL
- Replaces + with - and / with _ so the result can sit in a URL or a filename without percent-encoding. JWTs use it with the padding removed, which is why the padding option exists.
- MIME line wrapping
- Email requires lines of at most 76 characters, so MIME encoders insert a line break every 76 characters. Turn it on when pasting into an email source or a PEM-like block; leave it off for JSON, URLs and code.
Why text has to become UTF-8 first
Base64 encodes bytes, not characters, so text has to be turned into bytes before it can be encoded. The browser's built-in btoa() only accepts characters up to U+00FF and throws on anything else, which is why naive encoders fail on "€", "日本" or an emoji. This tool encodes text as UTF-8, the encoding nearly every system expects, so é becomes the two bytes C3 A9 and decodes back to é on any platform.
When decoding, the bytes are checked to be valid UTF-8. If they are not, the Base64 almost certainly holds a binary file rather than text, and the tool says so — and tells you which kind of file when it recognises the signature — instead of showing a screen of garbage characters.
Files: size, signatures and large inputs
Base64 makes data about a third larger: four characters for every three bytes, plus line breaks if you wrap. A 3 MB image becomes roughly 4 MB of text. The file view shows both sizes before you copy anything, which is worth a look before embedding a large file in a stylesheet or a JSON document.
Decoding a Base64 string to a file works the other way round. The first bytes of most file formats are a fixed signature — 89 50 4E 47 for PNG, %PDF for PDF, PK for ZIP (and so DOCX and XLSX) — so the tool reads them to name the download correctly and to preview images. Large files are encoded in chunks with a progress bar, so the page stays responsive, and very long results are previewed in part while copy and download always give you the whole thing.
For images specifically, the image to Base64 converter also writes ready-to-paste HTML, CSS and Markdown snippets.
Najczęstsze pytania
- How do I decode a Base64 string?
- Choose Decode and paste the string. The decoded text appears as you type. If the Base64 holds a file rather than text, switch to File mode to download it with the right extension.
- Is Base64 encryption?
- No. Base64 is a reversible encoding that anyone can decode without a key. It makes binary data safe to carry as text; it does not protect it.
- Why does Base64 make files bigger?
- Every three bytes become four characters, so the output is about 33% larger than the input, plus a little more if lines are wrapped for email.
- What is the difference between Base64 and Base64URL?
- Base64URL replaces the + and / characters with - and _ so the result can be used in URLs and filenames, and usually drops the = padding. JSON Web Tokens use Base64URL.
- Why does my decoded text look like random symbols?
- The Base64 probably holds binary data such as an image, a PDF or compressed bytes, not text. The tool detects this and offers to treat it as a file, which you can then download.
- What do the = signs at the end mean?
- They are padding. Base64 works in groups of three bytes, and when the input runs out partway through a group, one or two = signs fill the last four-character block. Many decoders, including this one, work with or without them.
- Can I convert a Base64 string to a PDF or image?
- Yes. In File mode, choose Decode and paste the string or the full data URI. The tool recognises PNG, JPEG, GIF, WebP, PDF, ZIP, GZIP and other formats from their first bytes, previews images and lets you download the file.
- Is it safe to paste sensitive data here?
- Encoding and decoding run entirely in your browser. Nothing you paste or drop is uploaded or stored.