Encode PDF to Base64

The converter helps to encode Portable Document Format (PDF) File to Base64 data and then to copy or download the result data in several formats. If you want to decode, use Base64 to PDF Decoder.

How to encode PDF File (.pdf) to Base64 Data

  1. Select or drag & drop one or several PDF files;
  2. Press Encode button (you will see the result below);
  3. Select output format (Plain Text, Data URL, HTML IFarme Tag, HTML Embed Tag);
  4. Copy or Download Base64 data;
  5. Done!

Output Formats

  • Plain Text - Only Base64 data;
  • Data Url - Base64 in data URL format (data:[<MIME-type>][;charset=<encoding>][;base64],<base64 data>)
  • HTML IFarme Tag - HTML Tag <iframe> with Data Url data in SRC property.
  • HTML Embed Tag - HTML Tag <embed> with Data Url data in SRC property.

Output Format Examples (truncated data, for example)

Plain Text:


Data Url:


HTML IFrame Tag:

<iframe src="data:application/pdf;base64,JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwv..."></iframe>

HTML Embed Tag:

<embed src="data:application/pdf;base64,JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwv..."></embed>

How to embed PDF Files (.pdf) to my site (HTML page)

If you want to add PDF to preview on the website, you should encode PDF files and select HTML Embed Tag format. You will get results like this code:

<embed src="data:application/pdf;base64,JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwv..."></embed>

Copy and Paste this code to your web page's <body> tag. You can set additional embed tag's attributes: width, height, and MIME Type. I'd like to know more info about embed tags

MIME Types for PDF

  • application/pdf;
  • application/x-pdf;
  • application/x-bzpdf;
  • application/x-gzpdf