Skip to the page
html reference · links & media

HTML <img src="" alt=""> tag

closing tag
none — void element
void element
yes
lives inside
anywhere in <body>, inline
typically holds
n/a (self-contained)

Where it goes

Wherever the picture should appear. It has no closing tag. <img> is complete on its own, like <br> and <hr>.

Example

<img src="cat.jpg" alt="A sleeping cat">

Open this example in the editor →

Common mistakes

  • Leaving off the quotes: src=cat.jpg. Browsers often show the picture anyway. It is still not valid, and this site's checks will not count it.
  • Skipping alt. It is required, not decoration. People who cannot see the picture get nothing without it.
  • Writing </img>. There is nothing to close.

Related

Updated 24 October 2026. Practice it in the html route, or read more on MDN.