The <embed> & <object> elements
The <embed> and <object> tags place external content, such as a PDF or an SVG file, into a page. <object> loads the file from its data attribute and shows the content between its tags as a fallback if the file can’t be displayed. <embed> is a simpler void element with no fallback. For images, video and web pages, prefer <img>, <video> and <iframe>.
Last updated: October 3, 2026
Quick facts
| Category | Flow content, phrasing content, embedded content, palpable content (<object> is also form-associated; <embed> is interactive) |
| Content model | <embed>: empty, it’s a void element. <object>: fallback content, shown if the resource can’t load |
| Tag omission | <embed>: void, no end tag. <object>: neither tag can be omitted |
| Permitted parents | Any element that accepts embedded content |
| DOM interfaces | HTMLEmbedElement, HTMLObjectElement |
Syntax
Live example
Edit the code below and watch the preview update instantly.
What about <param>?
The <param> element used to pass settings to browser plugins such as Flash, placed inside an <object>. Plugins are gone from modern browsers, and <param> is now obsolete in the HTML standard, so browsers ignore it. Don’t use it in new pages.
Attributes
<object>
| Attribute | Description |
|---|---|
| data | The URL of the file to embed |
| type | The file’s format, e.g. application/pdf or image/svg+xml |
| width / height | The display size in pixels |
| name | A name for the embedded content, for scripts or link targets |
| form | The id of a form the object belongs to |
<embed>
| Attribute | Description |
|---|---|
| src | The URL of the file to embed |
| type | The file’s format |
| width / height | The display size in pixels |
Common examples
A PDF with a download fallback
If the browser can’t display the PDF (common on phones), the content inside <object> appears instead.
An SVG with a PNG fallback
Unlike an <img>, an SVG in <object> can keep its own scripts and links working.
Embedding with <embed>
The shortest form. It has no fallback content, so check that the file type is widely supported.
<embed> / <object> vs <iframe>
<embed> and <object> were designed for plugin content such as Flash, which no longer exists. Today they’re mostly used for PDFs and SVGs. An <iframe> embeds a whole web page — a map, a YouTube video, a form from another site — and has a sandbox attribute to limit what that page can do.
For other websites and embed codes, use an iframe. For a PDF with a fallback link, <object> is a good fit. For images, video and audio, use <img>, <video> and <audio>.
| <object> | <embed> | <iframe> | |
|---|---|---|---|
| Fallback content | Yes | No | No |
| Sandbox option | No | No | Yes |
| Best for | PDF, SVG | Quick PDF embed | Web pages, embeds |
Common mistakes to avoid
- Embedding Flash, Java or other plugins. Browsers removed plugin support years ago; that content simply won’t show.
- Embedding a PDF without a download link. Many phones can’t display embedded PDFs, so always offer a link.
- Missing
type. Without it the browser may download the file before knowing whether it can display it. - Using embed for video. Use <video>, which has controls, captions and multiple formats.
Accessibility & SEO tips
- Search engines index PDFs as separate documents, so a plain link to the PDF is often better for SEO than embedding it.
- Put the most important information on the web page itself in HTML, not only inside an embedded PDF.
- Give embedded content a
titleoraria-labelso screen reader users know what it is.
Browser support
Supported in every browser, including Chrome, Edge, Firefox, Safari and their mobile versions — it has been part of HTML since the very first versions. Plugin content such as Flash no longer works anywhere; PDF display depends on the browser and is often unavailable on phones.
Tutorial: How to embed a YouTube video