# Base64 Encode & Decode - Free Online Base64 Converter

> Free online Base64 encoder and decoder: convert text, images and any file to Base64, and Base64 back to text or files. UTF-8 and GBK text, data URIs and URL-safe Base64; decoded images are previewed and downloadable. Processed locally, never uploaded.

- URL: https://qilingtools.com/en/base64
- Category: Developer Tools (https://qilingtools.com/en/dev)
- Tags: [Developer](https://qilingtools.com/en/tags/dev), [Encoding](https://qilingtools.com/en/tags/encode)
- Last updated: 2026-11-07
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

Convert text or files to Base64, or turn Base64 back into what it was. When encoding, type text or choose any file (image, PDF, font and so on), optionally with a data: prefix ready for a web page. When decoding, paste plain Base64 or a whole data URI such as data:image/png;base64,…; if the result is a file such as an image, PDF or archive, the tool recognizes the type, previews images and lets you download it. Text is handled as UTF-8, and legacy GBK-encoded Chinese is detected automatically. Everything runs in your browser and nothing is uploaded.

## How to use

1. Choose Encode or Decode
2. To encode, type text or click Choose a file…; tick Include data: prefix to use the result directly in a web page
3. To decode, paste the Base64 or a whole data URI; line breaks and spaces are ignored
4. The result appears instantly: Copy result for text, Download file when it decodes to a file

## Features

- Encode text or any file, optionally as a data URI
- Recognizes PNG, JPEG, GIF, WebP, PDF, ZIP, MP3, MP4, fonts and more when decoding, with image preview and download
- Paste a data URI directly; the data:…;base64, prefix is stripped automatically
- UTF-8 text, with automatic detection of legacy GBK-encoded Chinese
- Optional URL-safe output (- _ instead of + /, no trailing =); both forms are accepted when decoding
- Handles files of several MB; copy or download the full result as text

## FAQ

### Is Base64 encryption? Can it keep things secret?

No. It is just another way of writing data: any bytes expressed with 64 characters (A-Z, a-z, 0-9, + and /) so they fit where only text is allowed, such as JSON, URLs, email and HTML. Anyone can reverse it instantly with a decoder like this one; there is no key. Do not use it to protect passwords or private data; use real encryption for that.

### Why is the encoded result bigger?

Base64 turns every 3 bytes into 4 characters, so the size always grows by about a third (plus any trailing =). In our tests a 6.68 KB PNG became 9,128 characters and a 6 MB file over 8.38 million. That is why Base64 images in web pages are best kept to small icons of a few KB.

### How do I convert an image to Base64, or Base64 back to an image?

To encode, click Choose a file…, pick the image and tick Include data: prefix; the resulting data:image/png;base64,… can go straight into an HTML src or a CSS url(). To restore it, paste the whole string (with or without the data: prefix) into Decode: the tool shows that it is a PNG image with a preview, and Download file saves it. To get ready-made CSS background or HTML <img> code, see Image to Base64.

### The decoded result is gibberish. What now?

Most likely the content was never text. The tool recognizes common file types from their first bytes (images, PDF, ZIP, audio, video, fonts) and offers a download; even an unrecognized type can be downloaded and opened with the right program. If it is garbled Chinese, it may be legacy GBK data, which the tool retries automatically and tells you about; rarer traditional or uncommon characters outside the common GBK range may not be detected.

### What is URL-safe Base64?

In standard Base64, + and / have special meanings in URLs and = is often escaped, so URL parameters, JWT tokens and file names commonly use a variant that replaces + with -, / with _ and drops the trailing =. Tick URL-safe when encoding to get it; when decoding there is nothing to choose, since both forms are recognized.

### Can it decode Base64 with line breaks or spaces?

Yes. Email attachments and some certificate files wrap Base64 every 76 characters; line breaks and spaces are ignored when decoding, and missing = padding at the end is added back automatically.

### Are my files or data uploaded?

No. Everything runs locally in your browser with no network upload, and is discarded when you close the page.

### Do I need to sign up or pay?

No. The site is completely free, needs no account and has no usage limits.

## Related tools

- [JSON Formatter](https://qilingtools.com/en/json): Free online JSON formatter: beautify or minify, validate with the exact line and column of any error, browse a collapsible tree, sort keys and escape strings.
- [URL Encode/Decode](https://qilingtools.com/en/url-encode): Free online URL encoder and decoder: turn spaces, symbols and non-English text into percent-encoding such as %E4%BD%A0, or turn encoded links back into readable text. Handles single values or whole URLs, UTF-8 and GBK, and + as space. Real-time and local, no upload.
- [JWT Decoder](https://qilingtools.com/en/jwt): Free JWT decoder: read the header and payload, check expiry, and verify the signature with a secret, PEM, JWK or JWKS. Runs locally, nothing uploaded.
- [Timestamp Converter](https://qilingtools.com/en/timestamp): Free online Unix timestamp converter: convert timestamps and dates, auto-detect seconds or milliseconds, and show local, UTC, ISO 8601 and relative time.
- [Hash / Checksum](https://qilingtools.com/en/hash): Free hash calculator: MD5, SHA-1, SHA-256, SHA-384 and SHA-512 of text or files, with automatic comparison against a published checksum. Multi-GB files, no upload.
- [UUID Generator](https://qilingtools.com/en/uuid): Free online UUID generator: create UUID v4 (GUID) or time-ordered v7 in bulk with your browser's cryptographic RNG. Uppercase, no-hyphen and brace options, up to 100 at a time, one-click copy, generated locally.
- [Base Converter](https://qilingtools.com/en/base-convert): Free number base converter for binary, octal, decimal, hex and any base 2–36. Detects 0x/0b/0o prefixes and separators, with exact results for huge integers.
- [Regex Tester](https://qilingtools.com/en/regex): Free regex tester with live highlighting, capture and named groups, and g/i/m/s/u flags. Runaway backtracking is stopped, so the page never freezes.
