Link copied

If you need the exact Google Drive embed URL format for iframe, use this:

https://drive.google.com/file/d/FILE_ID/preview

The normal sharing URL (.../view?usp=sharing) is not the iframe URL.

This guide shows the exact format, copy-paste iframe examples, and common fixes when embed does not work.

1. Open sharing on the file

Right-click the file in Drive and choose Share (or Share from the submenu if it appears).

Right-click Share in Google Drive

In the sharing dialog, set General access to Anyone with the link and keep the role Viewer.
If that looks right, click Copy link.

Anyone with the link, Viewer, copy link

The URL usually looks like this:

The segment like 10N111TfBknfp_dIsVGqegf-SINLpzDKC is the file ID.

https://drive.google.com/file/d/10N111TfBknfp_dIsVGqegf-SINLpzDKC/view?usp=sharing

3. Correct Google Drive preview URL format for embed

The /view link is for opening the file in the browser.
Dropping it straight into an <iframe src> usually won’t embed.
For embedding, use the /preview URL.

https://drive.google.com/file/d/FILE_ID/preview

Option A: Build the iframe yourself

Replace the view?usp=... part with:

<iframe
  src="https://drive.google.com/file/d/FILE_ID/preview"
  width="640"
  height="480"
></iframe>
  • FILE_ID is the same ID from .../file/d/FILE_ID/view....
  • Adjust width / height for your layout (CSS max-width: 100% helps on small screens).

In Astro Markdown / MDX you can use raw HTML or wrap it in a component, depending on your setup.

Option B: Use Drive’s “Embed item” HTML

Open the file in the browser

Paste the view URL into the address bar — you’ll get Drive’s preview UI.

Get embed HTML from the menu

Use File → Share → Embed item (wording may vary slightly by account language).

File → Share → Embed item

Copy the iframe HTML

The dialog shows a ready-made iframe — copy it into your site.

Embed dialog with iframe

Example

<iframe
  src="https://drive.google.com/file/d/FILE_ID/preview"
  width="640"
  height="480"
></iframe>

What it looks like embedded

Common embed issues

Why does iframe open the Drive page instead of embedded preview?

You are probably using the .../view?... URL.
Switch to .../preview in iframe src.

Why is the iframe blank or permission denied?

Check file sharing first: Anyone with the link + Viewer.

Does this work for video and PDF?

Yes. The same /file/d/FILE_ID/preview format works for common Drive file types.

Summary

  1. Anyone with the link / Viewer (or your equivalent), then copy the link.
  2. For embedding use https://drive.google.com/file/d/FILE_ID/preview as iframe src.
  3. Either hand-build the iframe or use File → Share → Embed item to copy HTML.

That’s it.