Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

Base64 Encode & Decode

A file instead
Text

Paste text, or

CtrlV paste · Ctrl↵ run now

Base64
Ready
Ln 1, Col 1
Runs in your browser. Nothing you paste is uploaded unless you share it.

Encode text to Base64 or decode it: UTF-8 or another charset, URL-safe, MIME lines, line by line

Convert text to Base64 and back. Handles UTF-8 and emoji, text in Latin-1, Windows code pages, UTF-16, Shift_JIS or GBK, URL-safe Base64, MIME lines and missing padding; binary results download as a file.

How to use it

  1. Choose Encode or Decode. To encode for a URL or a JWT, turn on URL-safe; for email (MIME), turn on MIME for lines of 76 characters, and CRLF for CR LF line ends.
  2. Paste your text or Base64. Decoding accepts URL-safe characters, line breaks, missing padding and data: URLs. Turn on Line by line when each line is its own value; pick a Charset when the text isn’t UTF-8.
  3. Copy the result. If the decoded data is a file (image, PDF, ZIP, audio, a Word file …), download it instead.

Examples

Encode text with accents

Input
héllo 👋
Result
aMOpbGxvIPCfkYs=

Text is encoded as UTF-8 first, so non-English characters work.

Decode a Basic auth header value

Input
YWRtaW46czNjcjN0
Result
admin:s3cr3t

The part after "Basic " in an Authorization header is user:password in Base64.

Decode Latin-1 text

Input
aOlsbG8= · Charset ISO-8859-1
Result
héllo

In UTF-8 the byte e9 is not a character, so Auto shows binary data; Latin-1 reads it as é.

Encode a list, one value a line

Input
one
two
three · Line by line
Result
b25l
dHdv
dGhyZWU=

Standard vs URL-safe Base64

Standard Base64 uses + and / and pads with =. URL-safe Base64 (RFC 4648 §5), used in JWTs and many APIs, replaces them with - and _ and usually drops the padding, so the value can sit in a URL or filename unchanged.

The decoder accepts both, so you don’t need to know which one you have.

Base64 in code

Encode text as UTF-8 bytes first: a language that encodes its own string type (PowerShell’s Unicode, a Windows tool’s Latin-1) gives different Base64 for the same word. In a shell, printf adds no newline where echo does, and a stray newline changes the result.

Buffer.from('héllo', 'utf8').toString('base64');      // 'aMOpbGxv'
Buffer.from('aMOpbGxv', 'base64').toString('utf8');   // 'héllo'
Buffer.from('héllo').toString('base64url');           // URL-safe, no padding

When decoding fails

  • Node.js’s Buffer.from(text, 'base64') never throws: it skips what it can’t read, so bad input gives wrong bytes instead of an error.
  • Paste the text here: it reads standard and URL-safe Base64, with or without = and line breaks, and names a character that is in neither.
ErrorWhereUsual cause
Incorrect paddingPythonThe = at the end was cut off, or the text is URL-safe Base64 (- and _): use urlsafe_b64decode
number of data characters (5) cannot be 1 more than a multiple of 4PythonA character is missing: the text was cut while copying
Non-base64 digit foundPython (validate=True)A space, line break or - _ in the text
The string to be decoded is not correctly encodedBrowsers (atob)URL-safe characters, spaces, or text that was never Base64
illegal base64 data at input byte nGoThe character at that byte; RawURLEncoding reads - _ and no =

Character sets

Base64 holds bytes, not letters, so the same word gives different Base64 in different character sets: é is one byte (e9) in Latin-1 and Windows-1252 and two (c3 a9) in UTF-8. Encode with the set the receiving system reads, and decode with the one the text was written in.

Decoding uses your browser’s own decoders (the WHATWG Encoding standard), so a byte reads as it does in a web page. Encoding to a set writes the bytes those decoders read back; a character the set has no bytes for, such as an emoji in Windows-1252, is written as ? and named in a note. GB18030 and EUC-JP decode only; encode Chinese as GBK.

Sources: WHATWG Encoding standard, RFC 2045 §6.8 (MIME Base64, 76-character lines)

Questions

Why does decoding show "binary data"?
The decoded bytes aren’t valid UTF-8 text, so they are a file or text in another character set. The page names the file type from its first bytes (images, PDF, ZIP, Word, Excel and PowerPoint, audio, video, fonts and more) and lets you download it; up to 64 bytes, such as a key or a hash, also show in hex. For text in Latin-1, Windows-1252 or another set, pick it under Charset; UTF-16 with a byte order mark is read on its own.
Is Base64 a way to hide passwords?
No. It’s an encoding that anyone can reverse instantly. Credentials in Base64 (like Basic auth) are effectively plain text.
Why does Base64 end with = or ==?
Base64 writes every 3 bytes as 4 characters. When the last group has only 2 bytes, one = fills it; with 1 byte, two. URL-safe Base64 usually leaves the = out, and the decoder reads it either way.
Is my data or file uploaded?
No. Everything runs in your browser, so your data stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. That includes files you open.

Related tools