???? Build A Custom Qr Code Generator Using Python And Streamlit In Minutes!

QR codes are everywhere — from restaurant menus to event passes. But what if you could make your own QR code generator with full control over colors and content?
In this quick tutorial, I’ll show you how to build a fully functional QR Code Generator app using Python and Streamlit. It's beginner-friendly and runs in your browser!
???? What We’ll Build
A web app that lets you:
???? Enter any text or URL.
???? Choose custom colors for the QR code and background.
???? Download the generated QR code image.
Here’s a sneak peek of what it will look like:
???? Technologies Used
Python.
qrcode – for generating QR codes.
Pillow (PIL) – for image manipulation.
Streamlit – for turning Python into a web app.
???? Step 1: Install the Dependencies
First, install the required Python packages:
pip install streamlit qrcode pillow
???? Step 2: The Code
Create a file called qr_generator.py and paste the following code:
import streamlit as st
import qrcode
from PIL import Image
from io import BytesIO
st.title("???? QR Code Generator")
data = st.text_input("Enter text or URL:")
fill_color = st.color_picker("Pick QR color", "#000000")
bg_color = st.color_picker("Pick background color", "#ffffff")
if st.button("Generate QR Code") and data:
qr = qrcode.QRCode(box_size=10, border=4)
qr.add_data(data)
qr.make(fit=True)
img = qr.make_image(fill_color=fill_color, back_color=bg_color).convert("RGB")
st.image(img)
buffer = BytesIO()
img.save(buffer, format="PNG")
buffer.seek(0)
st.download_button(
label="Download QR Code",
data=buffer,
file_name="qr_code.png",
mime="image/png"
)
???? Step 3: Run the App
Just run this command in the terminal:
streamlit run qr_generator.py
Then open the browser, and you’ll see your own live QR generator ????.
Screenshots:
???? Bonus Ideas
Add a logo to the center of the QR.
Save a history of generated codes.
Turn it into a Chrome extension.
Deploy it with Streamlit Community Cloud.
???? Final Thoughts
With just a few lines of Python, you’ve built a cool and useful tool. You can now generate customized QR codes anytime — perfect for business cards, events, links, and more.
If you liked this, give it a ❤️ and follow me for more beginner-friendly Python + Streamlit projects.
Have questions or want to collab? Drop a comment below ????