What file is Base64 that starts with JVBERi0?
JVBERi0 = PDF A PDF. Every PDF begins with the bytes `%PDF-`, and those encode to `JVBERi0` in Base64. `iVBORw0KGgo` is a PNG, `/9j/` is a JPEG and `UEsDB` is a ZIP, which includes DOCX and XLSX.
Convert Base64 to PDF online: paste raw Base64, a data URI or a whole JSON response. Detects the real file type, flags truncated PDFs, and does PDF to Base64.
Read as:
Drop a PDF or any other file here, or click to browse
Any file type · up to 50 MB · never uploaded
Every file type begins with fixed "magic" bytes, so its Base64 begins with fixed characters. The prefixes below are computed from real file headers by the same engine this tool uses.
| Base64 starts with | File type | Magic bytes (hex) |
|---|---|---|
JVBERi0 | 25 50 44 46 2D | |
iVBORw0KGgoAAAANSUhEU | PNG | 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 |
/9j/ | JPEG | FF D8 FF |
R0lGOD | GIF | 47 49 46 38 |
UEsDB | ZIP / DOCX / XLSX / PPTX | 50 4B 03 04 |
0M8R4KGxGu | Office 97–2003 (DOC/XLS/PPT) | D0 CF 11 E0 A1 B1 1A E1 |
H4sI | Gzip | 1F 8B 08 |
UklGR | RIFF (WebP / WAV / AVI) | 52 49 46 46 |
SUQz | MP3 (ID3) | 49 44 33 |
e1xydG | RTF | 7B 5C 72 74 66 |
Written and reviewed by the engineers who build Go Tools' encoding tools. Every length, prefix and example on this page is produced by the page's own engine and checked by automated tests.
JVBERi0 = PDF A PDF. Every PDF begins with the bytes `%PDF-`, and those encode to `JVBERi0` in Base64. `iVBORw0KGgo` is a PNG, `/9j/` is a JPEG and `UEsDB` is a ZIP, which includes DOCX and XLSX.
+33.3% 4 characters for every 3 bytes, so about 33.3% larger: a 1 MB (1,048,576-byte) PDF becomes 1,398,104 characters. With a line break every 76 characters, as email attachments use, it is 1,434,896 characters, or 36.8% larger.
Base64 writes arbitrary bytes using only 64 safe text characters (A–Z, a–z, 0–9, +, /), with = as padding. Every 3 bytes become 4 characters. That lets a binary file such as a PDF travel through channels that only carry text — a JSON field, an XML element, an email body, a database text column. Converting Base64 to PDF simply reverses it: turn the characters back into bytes and save them with a .pdf extension. The trouble is that real Base64 rarely arrives clean: it comes with a data: prefix, JSON escapes, line breaks or a different alphabet, and many converters silently produce a file that will not open.
%PDF-1.4 → bytes 25 50 44 46 2D 31 2E 34 JVBERi0xLjQ= → the same bytes in Base64 data:application/pdf;base64,JVBERi0xLjQ= → data URI form
Handles data URIs, \/ and \n JSON escapes, quotes, MIME line breaks, URL-safe - _, %2B %2F from URLs, PEM headers and missing = padding — and shows each step it took.
Paste {"code":0,"data":{"file":"JVBERi0…"}} as is. The longest Base64-looking field is used and its path (data.file) is shown, so you know which field was decoded.
PDF, PNG, JPEG, GIF, WebP, DOCX, XLSX, PPTX, ZIP, GZIP, MP3, MP4 and more than 40 other formats are recognised from their first bytes. The download gets the right extension even when the prefix says otherwise.
Flags a PDF with no %%EOF (cut off while copying or by a column length limit), Base64 that was encoded twice, hex pasted as Base64, gzip-compressed data and encrypted PDFs.
PDFs open in the browser's built-in viewer, images and SVG are displayed, text and JSON are shown as text. HTML is never rendered — only its source — because it would run on this page.
Drop a file up to 50 MB and get plain Base64 or a data URI, optionally URL-safe or wrapped at 76 characters, with the exact size overhead.
base64.b64decode open('out.pdf', 'wb').write(base64.b64decode(s)). Use urlsafe_b64decode for - and _; b64decode ignores line breaks unless you pass validate=True.
java.util.Base64 Files.write(Path.of("out.pdf"), Base64.getMimeDecoder().decode(s)). getDecoder() rejects line breaks; getUrlDecoder() is for - and _.
Buffer fs.writeFileSync('out.pdf', Buffer.from(s, 'base64')). Buffer accepts both alphabets and ignores whitespace, but it also silently skips any other illegal character instead of throwing, so check the result starts with %PDF-.
atob / Uint8Array.fromBase64 Build a Uint8Array before making the Blob. Uint8Array.fromBase64() is the newer built-in; check support in your target browsers.
base64_decode file_put_contents('out.pdf', base64_decode($s, true)). Pass true for strict mode, otherwise invalid characters are silently dropped.
Convert.FromBase64String File.WriteAllBytes("out.pdf", Convert.FromBase64String(s)). Whitespace is allowed; - and _ are not.
base64 -d / certutil macOS and Linux: base64 -d < in.txt > out.pdf. Windows: certutil -decode in.txt out.pdf.
JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4K…
PDF · version 1.4 · downloaded as file.pdf
Starts with JVBERi0, which is %PDF-. Nothing to clean, so it is decoded as is.
"data:application\/pdf;base64,JVBERi0xLjQK…"
Read as: removed the surrounding quotes → undid JSON escapes → removed the data URI prefix (application/pdf)
PHP's json_encode and some Java serializers write / as \/. Pasted into a decoder that does not undo it, the backslash is an illegal character.
{"code":0,"data":{"name":"invoice.pdf","file":"JVBERi0xLjQK…"}} Read as: took the field data.file out of the JSON
No need to cut the string out by hand. The longest Base64-looking field is used and its path is shown.
data:application/pdf;base64,iVBORw0KGgoAAAANSUhEUgAA…
Warning: the data URI says application/pdf, but the bytes are PNG. Saved as file.png
Many converters would write a .pdf that no reader can open. The magic bytes win over the label.
255044462d312e370a…
Warning: this looks like hexadecimal — read as hex it is a PDF. [Decode as hex]
Hex digits are all legal Base64 characters, so Base64 decoding does not fail; it silently produces garbage. 25 50 44 46 is %PDF.
Raw Base64, data:application/pdf;base64,…, a string copied out of JSON with \/ escapes, or the whole API response. For very long strings use Open a .txt file instead of pasting.
The line under the box lists every clean-up step — prefix removed, escapes undone, padding added, field taken from the JSON. If something is wrong, the error names the exact character and position.
The badge shows the type read from the file's magic bytes. A yellow note appears if it is not actually a PDF, if the data URI lies about its type, or if the PDF is cut off before %%EOF.
PDFs open in the browser's own viewer, images and text are shown inline. Rename the file if you like and click Download. For the reverse direction, switch to PDF / file → Base64 and drop a file.
data:application/pdf;base64, is not part of the Base64. Leaving it in either throws (: and ; are illegal) or, in lenient decoders, corrupts the first bytes so the file no longer starts with %PDF-.
base64.b64decode(value) # value = 'data:application/pdf;base64,JVBERi0…'
b64 = value.split(',', 1)[1] if value.startswith('data:') else value
pdf = base64.b64decode(b64) A PDF is binary. Converting the decoded bytes to a string and writing that string with a text encoding replaces invalid bytes and changes line endings, which breaks the cross-reference table.
fs.writeFileSync('out.pdf', Buffer.from(b64, 'base64').toString()) fs.writeFileSync('out.pdf', Buffer.from(b64, 'base64')) Java's Base64.getDecoder() rejects line breaks. Base64 from email or from base64 on Linux is wrapped at 76 characters. Use the MIME decoder, or remove whitespace first.
byte[] pdf = Base64.getDecoder().decode(wrapped); // IllegalArgumentException
byte[] pdf = Base64.getMimeDecoder().decode(wrapped);
JWTs and many URL parameters use - and _ instead of + and /, and drop the = padding. A standard decoder rejects them or decodes the wrong bytes.
base64.b64decode(token_part) # contains - and _
base64.urlsafe_b64decode(token_part + '=' * (-len(token_part) % 4))
In the browser atob returns a binary string, one character per byte. Passing it to new Blob([str]) encodes it as UTF-8, turning every byte above 127 into two bytes. Copy it into a Uint8Array first.
new Blob([atob(b64)], { type: 'application/pdf' }) const bytes = Uint8Array.from(atob(b64), c => c.charCodeAt(0));
new Blob([bytes], { type: 'application/pdf' }) A PDF ends with %%EOF. If the Base64 was cut by a VARCHAR column, a log line limit or an incomplete copy, the file decodes but readers show an error or missing pages. Compare the length with what the sender produced.
SELECT LENGTH(pdf_b64) FROM docs; -- 65535: suspiciously round
ALTER TABLE docs MODIFY pdf_b64 LONGTEXT; -- or store the bytes in a BLOB
{"filename": …, "content": "<base64>"}. Encode the file here to build a test request for Postman or cURL.%%EOF tells you the column or the log line was too short.+ / (standard, section 4) and - _ (URL- and filename-safe, section 5). URL-safe Base64 usually omits = padding. Mixing both in one string means it was edited or joined.= makes the length a multiple of 4. Without it, a remainder of 2 or 3 can be restored; a remainder of 1 is impossible for any valid Base64 — a character was lost or added. = in the middle usually means two strings were concatenated.%PDF- for PDF, 89 50 4E 47 for PNG, 50 4B 03 04 for ZIP-based formats such as DOCX and XLSX. Those bytes fix the first Base64 characters, so the type can be read before decoding — see the table in the tool.%%EOF. If it does not appear in the last 1,024 bytes, the file was almost certainly cut short. The header may start up to 1,024 bytes in; most readers still open such files, so it is reported but not rejected.{"filename": "invoice.pdf", "mime": "application/pdf", "content": "…"}) or use a data URI, so the receiver does not have to guess.%PDF-. It catches wrong fields, double encoding and error pages returned as Base64 in one line of code.multipart/form-data or a pre-signed download URL is lighter for both ends.BLOB/bytea column is a third smaller and cannot be silently truncated like a VARCHAR. Encode to Base64 only at the API boundary.data:application/pdf;base64,, quotes, line breaks and JSON escapes can stay in — they are removed automatically. data: prefix was decoded as part of the data; the bytes were written as text instead of binary; the string was cut off (no %%EOF at the end); the Base64 was encoded twice; or it is not a PDF at all — for example a PNG or a JSON error message. Paste the same string here: each of these cases shows a specific warning. JVBERi0 is PDF, iVBORw0KGgo is PNG, /9j/ is JPEG, R0lGOD is GIF, UEsDB is ZIP (and therefore DOCX, XLSX, PPTX), H4sI is gzip. The tool reads the decoded magic bytes and shows the type, and saves the file with the matching extension. data:application/pdf;base64,JVBERi0…. Browsers can open it directly as a link or src. APIs usually want only the Base64 part after the comma. %PDF-. The type shown is what the bytes actually are. Common surprises are a PNG or JPEG scan, a DOCX, a ZIP of several PDFs, or a JSON or HTML error message that was Base64-encoded in place of the document. %%EOF. When it is missing, the Base64 was almost certainly truncated: copied only in part, cut by a database column such as a MySQL TEXT (65,535 bytes), or shortened by a log line limit. Get the full string again; decoding cannot recover missing data. Encoding & Formatting
The full ASCII table: 128 characters in decimal, hex, octal and binary, plus a two-way text-to-ASCII converter. Control characters come with escape sequences, caret notation and where you actually meet them.
Encoding & Formatting
Generate EAN-13, UPC-A, Code 128, Code 39 and 11 more barcode types as SVG or print-ready PNG. Type 12 digits and the check digit is filled in; get one wrong and we name the digit it should be.
Encoding & Formatting
Decode and encode Base64 online for free. Real-time conversion with full UTF-8 and emoji support. 100% private — runs in your browser. No signup needed.
Encoding & Formatting
Decode a Base64 string or data URI back into an image in your browser. Preview, read dimensions & MIME, then download as PNG, JPG, GIF, SVG. No upload.
Encoding & Formatting
Convert CSV to JSON in your browser. RFC 4180, type inference, header row, big-int safe. 100% private, no upload.
Encoding & Formatting
Paste garbled text and get the original back. Every plausible encoding chain — UTF-8, GBK, Big5, Shift_JIS, EUC-KR, Windows-1252 — is tried and ranked, with the exact chain shown. Free, private, runs in your browser.