How to Insert an Image in HTML? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes 3 Likes Like Report To insert an image in HTML, you can use <img> tag. This tag uses the src attribute to define the URL of the image file. We can also use CSS to insert image in HTML.Table of ContentUsing img TagUsing background-image propertyInsert an Image using img TagThe <img> tag is the primary method for inserting an image in HTML. The src attribute is used to specify the path of the image file. This tag is self-closing, making it essential for displaying images on a webpage.Example: Inserting image in a webpage using <img> tag. HTML <h2>Inserting an Image using img Tag</h2> <img src="https://media.geeksforgeeks.org/wp-content/uploads/20241008160104258350/gfg-demo.png" alt="Description of the image" /> Output Insert an Image using CSS background-image propertyImages can also be inserted using the CSS background-image property. It is useful when you want to style a webpage's background or use an image as part of the design, rather than as content.Example: Inserting an image using CSS background-image property. HTML <!DOCTYPE html> <html> <head> <style> .image-container { background-image: url( "https://media.geeksforgeeks.org/wp-content/uploads/20241008160104258350/gfg-demo.png"); width: 80%; height: 250px; background-repeat: no-repeat; } </style> </head> <body> <h2> Inserting Image using background-image Property </h2> <div class="image-container"></div> </body> </html> Output Create Quiz Comment Y ysachin2314 Follow 3 Improve Y ysachin2314 Follow 3 Improve Article Tags : Web Technologies HTML Class 7 HTML-Questions Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like