HTML <embed> Element

The <embed> element embeds external content directly within an HTML document. It can be used for resources that the browser or an available content handler can display, with PDF documents being a common modern example.

Syntax

<embed src="document.pdf" type="application/pdf" width="600" height="400">

The <embed> element is a void element and does not use a closing tag. The src attribute identifies the external resource, while other attributes can describe its type and displayed dimensions.

Attributes

The <embed> element supports the global HTML attributes and the following element-specific attributes:

Attribute Description
src Specifies the URL of the external resource to embed.
type Specifies the MIME type of the embedded resource.
width Specifies the displayed width of the embedded content in CSS pixels.
height Specifies the displayed height of the embedded content in CSS pixels.

Example

The following example embeds a PDF document within the page and provides a direct link to the document as an alternative:

Play in Editor

Usage Notes

The <embed> element depends on the browser or an available content handler being able to display the resource. Support for the element itself does not guarantee that every file format can be displayed.

PDF documents are a common use for <embed> because modern browsers generally include built-in PDF viewing capabilities. Older plugin-based formats such as Flash are no longer appropriate for modern websites.

Use the type attribute when the MIME type of the embedded resource is known. This helps identify the type of content the browser is being asked to display.

The width and height attributes establish the dimensions of the embedded content. CSS can also be used when responsive sizing or additional presentation control is required.

Because <embed> cannot contain fallback content, consider providing a nearby link to the external resource so visitors can open it separately if the embedded version cannot be displayed.

Accessibility

Embedded resources may not be equally accessible to every visitor. Provide an accessible version of the content when necessary and consider including a clearly labeled link that allows the resource to be opened separately.

When embedding documents such as PDFs, make sure the document itself has an appropriate title, logical reading order, meaningful headings, alternative text for informative images, and other accessibility features required by its content.

Browser Support

Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.

For detailed browser compatibility information, see Can I Use: HTML <embed> Element .

<object> - Embeds an external resource and can contain fallback content.

<iframe> - Embeds another HTML page or browsing context within the current document.

<video> - Embeds video content using native browser media controls and features.

<audio> - Embeds audio content using native browser media features.

Specifications

HTML Living Standard: The <embed> Element