Open In App

Create an QR Code Generator Project using HTML CSS & JavaScript

Last Updated : 24 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In today's digital world, QR codes are widely used and provide a practical way to share information and access content with a quick scan. This deeply manually operated will show you step-by-step how to create a QR code generator from scratch using HTML, CSS, and JavaScript.

This article will give you the knowledge necessary to develop an intuitive web-based application, regardless of whether you want to generate QR codes for URLs, contact details, or event tickets. Explore all aspects of QR code generation by following our step-by-step instructions. 

Preview Image

Web-capture_16-10-2023_123930_

Prerequisites

Approach

In this code example, we have used a library of JavaScript to create a QR code, and when the user enters any text or link in the input field and presses Enter, that keyword (text) will generate a new QR code by using qrcode.makeCode, and that QR code can be scanned by any device and will give the output that the user entered in the input field.

Example: The above approach implemented below.

HTML
<!--Index.html-->
<!DOCTYPE html>
<html lang="en">

<head>
    <link rel="stylesheet" href="./style.css" />

    <!-- External QR code library -->
    <!--This is the liberary which helps
        to convert simple data to the images-->
    <script src=
"https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js">
    </script>
</head>

<body>
    <div class="header">
        <div class="box">
            <h1>
                QR Code Generator
            </h1>
            <hr />
            <div class="sqrcode"></div>
            <div class="qrcode"></div>
            <input type="text" 
                   placeholder="Paste a URL or enter 
                                text, then press enter" 
                   onchange="generateQr()" />
            <!--generateQr() is the fuction which helps
                to convert data into QR using the js library-->
        </div>
    </div>
    <script src="./script.js"></script>
</body>

</html>
CSS JavaScript

Output:

Animation


Next Article

Similar Reads