Base64 Encoder & Decoder
Encode or decode base64: text, files, base64url, MIME line breaks and data URLs, with image preview.
- Free
- No sign-up
- Runs in your browser
See it in action
Hello, world! 👋
SGVsbG8sIHdvcmxkISDwn5GL<<???>> in base64, then base64url
PDw/Pz8+Pg==PDw_Pz8-PgeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
{"alg":"HS256","typ":"JWT"}
18 bytes → 24 characters
Runs in your browser. Nothing you type is uploaded or stored, and no sign-up is needed.
Updated
See it in action
Hello, world! 👋
SGVsbG8sIHdvcmxkISDwn5GL<<???>> in base64, then base64url
PDw/Pz8+Pg==PDw_Pz8-PgeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
{"alg":"HS256","typ":"JWT"}
This base64 encoder and decoder turns text or a file into base64 and turns base64 back into text or a file, as you type. Text is encoded as UTF-8, so accents, scripts and emoji survive the round trip. It handles standard base64 and base64url (the URL-safe alphabet used in JWTs), with or without = padding, adds MIME line breaks every 76 characters if you need them, and reads or makes data: URLs, with a preview when the result is an image. If the base64 is broken it tells you which character and where. It follows RFC 4648, is free, needs no sign-up, and your data never leaves your browser. Use it as a base64 converter in both directions: text to base64, base64 to text, string to base64, base64 to string, file to base64 and base64 to file.
How to use it
Choose Encode and type or paste your text, or tap Encode a file. The base64 appears below as you type.

Choose Decode and paste base64, base64url or a data: URL. Text is shown as text; a JWT header, for example, decodes to readable JSON.

Files and images come back as files: an image data URL is previewed, and Download saves it with the right extension. Copy or Swap the result when you are done.

Options
- Encode or Decode
- Encode (a b64 encode, as it is often shortened) turns text or a file into base64; Decode turns base64, base64url or a data: URL back into text, or into a file you can download.
- Encode a file
- Pick any file up to 10 MB (an image, a PDF, anything) to go from file to base64, or to a data: URL with its file type.
- URL-safe (base64url)
- Tick it to base64url encode: it uses - and _ instead of + and /, the alphabet defined for URLs and file names (RFC 4648 §5). The decoder accepts both alphabets automatically.
- = padding
- Adds = signs so the length is a multiple of 4, as RFC 4648 requires unless a format says otherwise. Turn it off for base64url as used in JWTs. The decoder accepts base64 with or without padding.
- Line breaks
- None, every 76 characters (MIME, the limit for email in RFC 2045) or every 64 (PEM). The decoder skips line breaks and spaces.
- As a data: URL
- Wraps the result as data:[type];base64,… (RFC 2397), ready to paste into HTML or CSS.
- Decoded text or file
- If the bytes are valid UTF-8 they are shown as text; base64 to ASCII works the same way, because ASCII text is valid UTF-8. Otherwise the tool shows the size, the first bytes in hex and, for PNG, JPEG, GIF, WebP, PDF and ZIP data, the likely file type, so you can download it with the right extension. Images are previewed.
- Clear errors
- A character that is not base64 is reported with its position; mixed alphabets, a length that cannot be base64 and data after the padding are caught too. Extra bits in the last character get a warning.
- Swap, copy, download
- Swap puts the result back as input in the other mode. Copy the result, or download it as a .txt file or as the decoded file.
What base64 is
Base64 (also written base 64) writes any data, text or binary, using only 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding at the end. Every 3 bytes become 4 characters, so base64 is about a third larger than the original: 3 bytes take 4 characters, 300 bytes take 400.
It exists because many systems were built for text only: email, JSON, URLs, XML, HTML attributes. Base64 lets you carry an image, a key or a file through them unchanged. It is defined by the IETF in RFC 4648.
Source: IETF RFC 4648, The Base16, Base32, and Base64 Data Encodings
Base64 encode and base64 decode: how it works
- To base64 encode, the bytes are read 3 at a time (24 bits) and split into 4 groups of 6 bits; each 6-bit value (0–63) picks one character from the alphabet.
- If the data does not divide into groups of 3 bytes, the last group is shorter and = signs fill the gap: Zg== for one byte (f), Zm8= for two (fo), Zm9v for three (foo). These are the RFC's own test values, and this page's tests check them.
- To base64 decode, the process runs backwards: 4 characters give 3 bytes. Text is turned into bytes as UTF-8 first, which is why an emoji (4 bytes in UTF-8) becomes more base64 than a plain letter.
- Base64 is an encoding, not encryption: there is no key, and anyone can decode it, as this page does. Do not use it to hide passwords or secrets.
Standard base64 vs base64url
JSON Web Tokens (JWTs) use base64url with the trailing = removed and no line breaks, as RFC 7515 defines it. Paste the first part of a JWT (before the first dot) into Decode to read its header; this tool decodes but does not verify signatures.
| Standard base64 | base64url | |
|---|---|---|
| Characters 62 and 63 | + and / | - and _ |
| Padding | = at the end | Often left out (JWTs omit it) |
| Safe in URLs and file names | No: + and / have special meanings | Yes |
| Example: <<???>> | PDw/Pz8+Pg== | PDw_Pz8-Pg |
Source: IETF RFC 7515, JSON Web Signature, §2 (Base64url Encoding)
Data URLs: base64 images in HTML and CSS
A data URL puts a whole file inside a link: data:[type];base64,[data], as RFC 2397 defines. For example data:image/png;base64,iVBORw0KGgo… can be used as the src of an img tag or a CSS background, with no separate file to load.
To make one, choose Encode, pick a file and tick As a data: URL; the file's type is filled in for you. To go from base64 to image, or turn any data URL back into a file, paste it into Decode: images are previewed and Download saves the file. Remember that base64 is a third larger than the file itself, so this suits small images and icons.
Line breaks, padding and invalid base64
- Email (MIME) limits base64 lines to 76 characters (RFC 2045); PEM files such as certificates use 64. Outside those formats RFC 4648 says not to add line breaks, so None is the default.
- RFC 4648 says a decoder must reject characters outside the alphabet unless a format says otherwise. This decoder skips only spaces and line breaks (so wrapped base64 pastes cleanly) and reports any other character with its position.
- A length that leaves one character over (for example 5 characters) cannot be complete base64: part of the text is missing, so the decoder stops with an error.
- When the last character carries bits that belong to no byte (Zh== instead of Zg==), the data still decodes, with a warning, because RFC 4648 lets strict decoders reject it.
Limits
- Files up to 10 MB for encoding.
- Very long results show their first 100,000 characters on the page; Copy and Download always include everything.
- File types are recognized for PNG, JPEG, GIF, WebP, PDF and ZIP from their first bytes, or from the type in a data URL; anything else downloads as .bin.
Questions
How do I decode base64?
Choose Decode and paste the base64: this base64 decoder shows base64 to text at once, and if the data is a file, Download saves it as a file.
How do I convert an image to base64?
Choose Encode, tap Encode a file and pick the image. Tick As a data: URL to get a string you can use directly in HTML or CSS.
Why does my base64 end with = or ==?
The = signs are padding: they show that the last group had only 1 or 2 bytes instead of 3. base64url often leaves them out.
What is the difference between base64 and base64url?
base64url replaces + with - and / with _ so the result is safe in URLs and file names, and it usually drops the = padding.
Is base64 encryption?
No. Data that is base64 encoded is not base64 encrypted, and base 64 encryption does not exist as such: there is no key, and anyone can decode it. Use it to carry data through text-only systems, not to keep it secret.
Why is the base64 bigger than my text?
Every 3 bytes become 4 characters, so base64 is about 33% larger, and non-English letters and emoji take 2 to 4 bytes each in UTF-8.
Is this online base64 encoder free?
Yes. Base64 encode online or decode base64 online in any browser, as often as you like, with no sign-up. Files can be up to 10 MB.
Is my data uploaded?
No. Encoding and decoding run in your browser; nothing you type or pick is sent anywhere.
More free tools
- Diff CheckerCompare two texts or files side by side, by line, word or character, and export the changes as a .diff.Use it
- JSON Formatter & ValidatorFormat, validate and fix JSON: exact error line and column, beautify or minify, tree view, big numbers kept exact.Use it
- Regex TesterTest a JavaScript regex live: highlighted matches, capture groups, replace, every flag and a plain-English explanation.Use it
- URL Decoder & EncoderDecode and encode URLs: percent-escapes to text, + as space, double encoding, and a link's query parameters decoded.Use it
AI tools for the same job

Replit
FreemiumFrom $18/moTurn ideas into apps in minutes — no coding needed
Coding & Development
JetBrains AI
FreemiumFrom $10/moAI code completion and coding agents across JetBrains IDEs and JetBrains Air
Coding & Development
Amazon Q Developer
FreemiumFrom $19/moGenerative AI-powered assistant for software development
Coding & Development