HTML Tags

HTML <embed> Tag

The <embed> tag in HTML is used to embed external content such as videos, audio, PDFs, or interactive media (like SVGs or Flash) directly into a webpage.
It is a self-closing tag and doesn’t require a closing tag. It serves as a generic container for external resources when specific tags (like <video> or <audio>) are not suitable.

Syntax

<embed src="filename" type="mime/type" width="600" height="400">

Attributes

AttributeDescription
srcSpecifies the path (URL) of the external file to embed.
typeDefines the MIME type of the embedded content (e.g., video/mp4, application/pdf).
widthSets the width of the embedded content (in pixels).
heightSets the height of the embedded content (in pixels).

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML embed Tag Example</title>
</head>
<body>

  <h2>Embedding a PDF File</h2>
  <p>The following example embeds a PDF file directly inside the webpage:</p>

  <embed src="/samples/sample.pdf" type="application/pdf" width="700" height="500">

  <hr>

  <h2>Embedding a Video File</h2>
  <p>Below is an example of embedding a video file using the embed tag:</p>

  <embed src="/samples/sample_video.mp4" type="video/mp4" width="640" height="360">

</body>
</html>

Output

Browser Output

Use our TryIt Editor to see the output

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes✅Yes

The PDF file appears inline with scroll and zoom options inside the page.
The video plays directly inside the defined area if supported by the browser.

Notes

  • <embed> is a generic container for external content; use it when a specialized element (like <audio>, <video>, or <object>) isn’t suitable.
  • Many use-cases (video/audio) are better handled by <video> / <audio> because those provide built-in controls and better accessibility.
  • For documents (PDF) consider <iframe> or <object> as alternatives — browser UI and print/zoom support may differ.
  • Some embedded content types may require browser plugins or specific MIME handlers; these cases can produce inconsistent behavior across browsers.
  • Security: avoid embedding untrusted content. Use correct type and host files over HTTPS to prevent mixed-content issues.
  • Accessibility: provide fallback content and ensure embedded content is reachable via keyboard/screen readers when applicable.
  • Sizing & responsiveness: use CSS (or wrapper elements) to make embedded content responsive; fixed width/height can break layouts on small screens.

Conclusion

The <embed> tag is a versatile tool for embedding various types of media into a webpage.
While it provides a simple way to display external content like PDFs or videos, it lacks advanced playback controls — so for audio or video content, dedicated tags like <video> and <audio> are generally preferred.

Sign In Form

User your email and password to singn in

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend