Documentation

Let's say you want to turn a text or URL into a QR code. This little tool makes it easy.

Simply type what you want to encode in the field below, then click on the button.

Please consider to see our generator to have more options.

How does it work?

In practice, we often use a JavaScript library such as QRCode.js, which takes care of generating an image based on the text entered.

Here's what happens in detail:

  1. JavaScript retrieves the text from the user input.
  2. The existing QR code is deleted (if any).
  3. A new QR code is generated and displayed on the page.

JavaScript code example

function generateQRCode() {
    const container = document.getElementById("qrcode");
    const text = document.getElementById("text").value.trim();
    container.innerHTML = "";

    if (text) {
        new QRCode(container, {
            text: text,
            width: 128,
            height: 128,
        });
    } else {
        alert("Please enter a text or URL.");
    }
}

This code uses the QRCode.js library to generate the QR code, which you need to include in your page for it to work.