PDF header
- Input
- JVBERi0xLjQK
- Expected output
- %PDF-1.4 (PDF)
9 bytes: %PDF-1.4 and a line break.
base64 to pdf
Paste the text into the Base64 to file field. Within half a second the tool decodes it, checks that the first bytes are %PDF- and shows the document in the preview. If something is wrong, it says what and at which position.
9 bytes: %PDF-1.4 and a line break.
The prefix is removed and noted.
Spaces and line breaks are ignored, as RFC 2045 requires.
11 characters: the remainder 3 is worth 2 bytes, and the = is added.
4 x ceil(1,000,000 / 3).
Paste the Base64 (with or without the data:application/pdf;base64, prefix) and check that the detected type is PDF. A PDF in Base64 starts with JVBERi, which is %PDF- encoded. The tool shows the PDF in the preview and downloads it with a .pdf extension. If the API response is JSON, paste the whole JSON: it finds the longest field that looks like Base64 and lets you switch fields.
It may have a data:application/pdf;base64, prefix before it, sit inside a JSON, be encoded twice (then it starts with something like SlZCRVJp, and the tool offers to decode again) or not be a PDF at all. The detected type shows right under the field.
Yes. The File name field is editable before downloading, and characters not allowed in file names are replaced with underscores.
No. Decoding, the SHA-256 and the preview use only your browser memory, and nothing goes to a server.
import base64
with open('file.bin.b64', 'r') as src, open('file.bin', 'wb') as dst:
dst.write(base64.b64decode(src.read()))import base64
with open('arquivo.pdf', 'rb') as src, open('arquivo.pdf.b64', 'w') as dst:
dst.write(base64.b64encode(src.read()).decode('ascii'))Everything is processed in your browser. Nothing is sent.