How to Turn an Image into a Link in HTML?

Last Updated : 23 Jul, 2025

Turning an image into a clickable link in HTML is a simple process that can enhance user interaction on your website. By wrapping an image inside an anchor tag (), you can make it clickable and redirect users to a different page or website.

1. Redirecting to a Specific Page

To turn an image into a link in HTML, wrap the tag inside an tag. This makes the image clickable, and it will redirect to a specific page.

Syntax:


    Clickable Image

Now, let us understand with the help of the example:

HTML
<html>
<body style="text-align: center;">
    <h3>
        Click on GeeksforGeeks logo to
        Redirect into geeksforgeeks.org
    h3>
    <a href="https://www.geeksforgeeks.org/">
        <img src=
"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png"
            alt="Click to visit geeksforgeeks.org">
    a>
body>
html>

Output

In this example:

2. Opening the Link in a New Tab

By default, clicking the image link will open the destination URL in the same browser window. If you want to open the link in a new tab, you can use the target="_blank" attribute.

Now, let us understand with the help of the example:

HTML
<html>
<head>
    <style>
        body {
            text-align: center;
            background-color: #f4f4f4;
        }
        h3 {
            color: #333;
        }
        a {
            text-decoration: none;
        }
        #logo {
            width: 250px;
            height: auto;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease-in-out;
        }
        #logo:hover {
            transform: scale(1.2);
        }
    style>
head>
<body>
    <h3>
        Click on the styled logo
        to visit GeeksforGeeks
    h3>
    
    <a href="https://www.geeksforgeeks.org/" target="_blank" 
        rel="noopener noreferrer"> 
        <img id="logo" src=
            "https://media.geeksforgeeks.org/gfg-gg-logo.svg" 
            alt="GeeksforGeeks Logo">
    a>
body>
html>

Output

In this example:

Best Practices

Conclusion

Turning an image into a link in HTML is a straightforward process that enhances the interactivity of your web pages. By using the tag to wrap an image, you can easily create clickable images that redirect users to other pages, external websites, or content. Additionally, adding styling effects and accessibility features improves the user experience, making your webpage more user-friendly and responsive.