HTML <embed> Tag

Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview

Definition and Usage

The <embed> element embeds external content at a point in the document. The browser (or a built-in handler) displays the resource from src, such as an image or a PDF in the browser’s PDF viewer.

Prefer dedicated elements when they fit better: <video>, <audio>, <img>, <iframe>, or <object> (especially when you need fallback content).

Baseline · Widely available.

Not deprecated and not experimental. Stable across modern browsers since about July 2015.

Plugins are gone.

Do not rely on Flash or other classic browser plug-ins. Modern engines no longer support them. Use HTML media and documents the browser can handle natively.

Void element.

<embed> has no end tag and no child fallback markup. Keep attributes on the single start tag.

HTML Syntax

syntax.html
<embed src=" url" type="mime" width="n" height="n">

Start tag only. No contents. Set src, optional type, and absolute width / height in CSS pixels (not percentages).

Attributes

The attributes you will use most often on <embed>:

AttributeDescriptionTry it
srcURL of the resource to embedTry it
typeMIME type of the resource (for example image/png or application/pdf)Try it
widthDisplayed width in CSS pixels (absolute; no %)Try it
heightDisplayed height in CSS pixels (absolute; no %)Try it
titleShort accessible name for the embedded content (recommended)Try it

Global Attributes

The <embed> tag also supports the Global Attributes in HTML.

Live Preview

Change src and size on a real <embed> that loads an image resource.

Study demo with an image MIME type. Prefer <img> for normal pictures in real pages.

Embed

src="/images/javascript.png" 160×120

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Basic Resource Embed

Point src at a resource and declare its MIME type.

HTML
<embed
  src="/images/javascript.png"
  type="image/png"
  width="160"
  height="120"
>
Try It Yourself

How It Works

  1. Write a single <embed> tag (void — no closing tag).
  2. Set src to the resource URL.
  3. Set type to the MIME type when you know it.
  4. Give absolute width and height in CSS pixels.

Example 2 — Explicit Dimensions

Width and height must be absolute pixel values, not percentages.

HTML
<embed
  src="/images/circle_image.jpg"
  type="image/jpeg"
  width="200"
  height="150"
>
Try It Yourself

How It Works

  1. Choose the display box with width and height.
  2. Use numbers only (for example 200), not 50%.
  3. Match the resource aspect when you can to avoid awkward cropping.
  4. Remember: object-fit does not affect <embed>.

Example 3 — Accessible title

Label the embed so assistive tech can describe what it contains.

HTML
<embed
  src="/images/nature-pattern.jpg"
  type="image/jpeg"
  width="200"
  height="140"
  title="Nature pattern preview"
>
Try It Yourself

How It Works

  1. Add title with a concise description of the embedded content.
  2. Avoid vague labels like “embed” or “file”.
  3. Especially important when the resource is interactive (audio/video-like content).
  4. Keep globals available — title is one of them, documented for accessibility on embeds.

Example 4 — Prefer <video> for Movies

For playable video with controls and fallback text, use <video> instead of <embed>.

HTML
<!-- Prefer this for video -->
<video src="clip.mp4" controls width="640" height="360">
  Your browser does not support HTML video.
</video>

<!-- Avoid relying on embed + old plugins -->
<!-- <embed src="clip.mp4" type="video/mp4" width="640" height="360"> -->
Try It Yourself

How It Works

  1. Ask what you are embedding (video, audio, page, PDF, image).
  2. Pick the dedicated element when one exists (video, audio, iframe, img).
  3. Use object when you need inner fallback markup.
  4. Reach for embed mainly when a simple native handler (like a PDF viewer) is enough and you do not need children.

Edge Cases & Pitfalls

Most embed issues come from plugins, missing labels, or using the wrong element.

plugins

No Flash / NPAPI

Classic plug-ins are unsupported. Ship HTML media or documents the browser can open itself.

fallback

No child fallback

<embed> cannot wrap alternate HTML. Prefer <object> or <video> when you need fallback content.

sizing

No percentage width/height

Attributes must be absolute CSS pixel lengths. Scale with CSS on a wrapper if you need fluid layout.

a11y

Always name it

Add a concise title. Without it, screen reader users may not know what the embed contains.

css

object-fit ignored

object-fit does not apply to <embed>. object-position can still adjust placement in the frame.

Browser Support

The <embed> element is core HTML. Support for a given resource depends on what the browser can handle (image, PDF viewer, and so on).

✓ Baseline · Widely available

<embed>

Widely available since about July 2015. Element support is universal; plug-in content is not. Prefer native HTML media and documents.

95% Element support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<embed> Widely supported

Bottom line: Safe as an embedding hook for browser-handled resources. Do not depend on obsolete plug-ins; choose video, audio, iframe, img, or object when they fit better.

Key Takeaways

  • Role: <embed> inserts external content the browser can handle.
  • Core attrs: src, type, absolute width/height, and a clear title.
  • Void: no end tag and no fallback children — use object/video when you need them.
  • Modern path: skip plug-ins; prefer dedicated media and frame elements first.

One line: use <embed> for simple browser-handled resources — and label it with title.

Default CSS Settings

Typical user-agent styling treats embed as a replaced element:

default.css
embed {
  display: inline;
}

Visible size usually comes from the width and height attributes (or CSS). object-fit has no effect; object-position may adjust placement.

Frequently Asked Questions

The embed element places external content in the page. The browser (or a handler it supports) displays the resource pointed to by src, such as an image or a PDF in a built-in viewer.
Yes. It has a start tag only and no end tag. It cannot contain fallback HTML children the way object can.
src (resource URL), type (MIME type), width and height (CSS pixels, not percentages), and title (accessibility label for the embedded content).
No. Modern browsers do not support classic browser plug-ins such as Flash. Prefer video, audio, img, iframe, or object for today’s content.
Use iframe for nested browsing contexts and sandboxed pages. Use object when you need fallback content inside the element. Prefer video/audio for media with native controls.
No. object-fit has no effect on embed. You can use object-position to adjust placement within the frame.

Next: fieldset

Group related form controls with a caption.

fieldset tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful