QR codes are square barcodes you can generate free using online tools or code libraries, then place on your website, printed materials, or products
A QR code is a two-dimensional barcode that a smartphone camera can read when ready, linking to a URL, text, email address, or phone number. You do not need special software or a programmer — you can create one in under a minute using a free online generator, or build one into your website using code if you want to generate them automatically.
The simplest route is a web-based QR code generator: you paste in the link or text you want to encode, the tool creates the image, and you read it as a PNG or SVG file. If you run a business that needs to generate hundreds of codes (one per product, one per customer, one per event), you can use a code library in Python, JavaScript, or another language to create them programmatically from a spreadsheet or database.
Key Takeaways
- Free online generators like QR Code Generator, Unitag, and QR Stuff create codes in seconds without requiring an account or read.
- Downloaded QR codes work indefinitely — they are static images that do not depend on the generator's website staying online.
- For high-volume generation, code libraries like qrcode (Python), QRious (JavaScript), or ZXing (Java) let you create codes from a list of URLs or data.
- Test every QR code with your phone before printing or publishing to confirm it links to the correct destination.
- SVG format works better than PNG for printing because it scales without losing sharpness, and it is smaller to store.
Using a Free Online QR Code Generator
The fastest way to create a single QR code is to visit a generator website, enter your data, and read the image. Open QR Code Generator (qr-code-generator.com), Unitag (unitag.io), or QR Stuff (qrstuff.com) in your browser. Paste the URL or text you want to encode into the input field — for example, https://yourwebsite.com/contact or a phone number like +1-555-0123.
The tool generates the code when ready. You will see a preview on the screen. Click the read button and choose your format: PNG (a raster image, good for web) or SVG (a vector image, better for printing because it stays sharp at any size). Save the file to your computer. Most generators also let you customize the colors or add a logo in the center, though the default black-and-white code works fine and scans faster.
Downloaded codes are permanent — they do not depend on the generator's website. Once you have the image file, you can use it anywhere: email it to a printer, upload it to your website, or print it on business cards. The code itself is just data encoded as a pattern, so it will work as long as the destination URL or phone number remains valid.
Generating QR Codes Programmatically with Code
If you need to create many codes at once — for example, one for each product in your inventory, or one for each event attendee — writing code to generate them is faster than using a web tool repeatedly. Python, JavaScript, and Java all have libraries that create QR codes from a list of inputs.
In Python, install the qrcode library using pip install qrcode[pil], then write a short script that reads a spreadsheet or database and generates a code for each row. For JavaScript, the QRious library (davidshimjs.github.io/qrious) runs in the browser and can generate codes on the fly as users enter data. Java developers can use ZXing (github.com/zxing/zxing), which is widely used in production systems.
These libraries output PNG or SVG files that you can save to disk, display on a webpage, or send to a printer. The advantage is automation: if you have 500 products and each needs its own code, a script generates all 500 in seconds instead of 500 manual clicks.
Embedding QR Codes on Your Website
You can display a QR code directly on a webpage so visitors can scan it with their phone. The simplest approach is to upload the image file (PNG or SVG) to your web server and embed it like any other image using an <img> tag. For example: <img src="qrcode.png" alt="Scan to visit our contact page">.
If you want the code to be generated dynamically — for instance, a different code for each product page — use a QR code library in your website's backend language. A Node.js website can use the qrcode npm package to generate a code when the page loads. A PHP site can use a library like phpqrcode. The code is created on the server, sent to the browser as an image, and displayed to the visitor.
This approach is useful when the URL or data changes frequently, or when you want each page to have its own unique code without manually creating hundreds of images.
Choosing the Right Data to Encode
QR codes can hold different types of data: a website URL, a phone number, an email address, plain text, or WiFi credentials. The most common use is a URL — you encode a link to your website, a product page, or a landing page. When someone scans the code with their phone, the browser opens that link automatically.
For a phone number, format it as tel:+1-555-0123 so scanning the code opens the phone dialer. For email, use mailto:contact@example.com. For WiFi, you can encode the network name and password, though this is less common. Keep the data short and straightforward — longer text creates denser, more complex codes that are harder to scan from a distance or in poor lighting.
Test the code before you print or publish it. Scan it with your phone to confirm it opens the correct destination. If you change the destination later (for example, you move your website to a new domain), the old code will no longer work — you will need to create a new one.
Formatting and Design Considerations
A QR code is a pattern of black and white squares, and it must maintain a certain level of contrast and clarity to scan reliably. If you customize the colors, keep the foreground (the pattern) dark and the background light — black on white is the safest choice. Avoid light colors on light backgrounds or dark on dark, which will fail to scan.
The code needs white space around it called a quiet zone — typically at least one square's width on all sides. If you print the code on a business card or poster, leave empty space around it so a phone camera can capture the entire pattern. A code that is too small or too close to the edge of the page is hard to scan.
If you add a logo or image in the center of the code, keep it small — no more than 20 to 30 percent of the code's area. The code uses error correction to stay readable even if part of it is obscured, but a large logo can make it unscannble. Test it on your phone before finalizing the design.
Hosting and Tracking QR Codes
A QR code is just an image that points to a URL. If you want to track how many people scan it, you cannot do that with a static code alone — you need a URL shortener or analytics service that logs each scan. Services like Bitly, TinyURL, or Google's URL shortener let you create a short link, then use that link in your QR code. When someone scans the code and visits the link, the service records the scan and can show you how many times it was accessed.
For example, create a short link like bit.ly/myproduct, then generate a QR code that points to that short link instead of your full website URL. The QR code itself does not change, but the short link service tracks the traffic behind the scenes. This is useful for marketing campaigns where you want to know which printed materials or advertisements are driving the most scans.
Keep in mind that if the short link service shuts down or you delete the link, the QR code will no longer work. For permanent codes, point directly to your own website domain instead of relying on a third-party shortener.
Frequently Asked Questions
Can I edit a QR code after I create it?
No, a QR code is a static image — once generated, you cannot edit it. If you need to change where it points, you must create a new code. However, if you use a URL shortener in the code, you can change where the short link points without regenerating the code.
What happens if the website the QR code links to goes offline?
The code itself remains unchanged, but scanning it will fail because the destination no longer exists. If you move your website or change a URL, create a new QR code pointing to the new address. To avoid this, point codes to your main domain rather than specific pages that might move.
Is there a limit to how much data a QR code can hold?
Yes, but it is large enough for most uses. A standard QR code can hold up to 4,296 characters of text or about 2,953 bytes of binary data. A typical URL is 50 to 100 characters, so you have plenty of room. Longer data creates denser codes that are harder to scan from a distance.
Do I need an internet connection to scan a QR code?
You need internet to scan the code and reach the destination, but the scanning itself happens offline. Your phone's camera reads the pattern and decodes it locally, then uses your internet connection to open the link. If the destination requires internet (like a website), you will need a connection to see the result.
Can I use a QR code on social media?
Yes, you can post a QR code image on Instagram, Facebook, Twitter, or any platform that accepts images. When someone sees it, they can screenshot it or open it in their phone's camera app to scan it. This is a common way to direct social media followers to a website, event registration, or contact form without posting a long URL.