Encode PDF to Base64

The converter helps to encode Portable Document Format (PDF) File to Base64 data then to copy or download a result data in several formats. If you want 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 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 file to my site (HTML page)

If you want add PDF to preview in web site, you should encode PDF file and select HTML Embed Tag format. You will get result like this code:

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

Copy Paste this code to <body> tag of your web page. You can set addition embed tag's attributes are width, height and MIME Type. More info about embed tag

MIME Types for PDF

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