BASE64
Decoderen & Coderen
← Guides· 4 min read

Base64 to QR Code – How It Works & When to Use It

Why you'd combine Base64 encoding with QR codes, how to generate one online, size limits, and code examples in Python and JavaScript.

Try it now — free online tool

Type any text → Base64 encodes instantly → Generate & download QR

Open QR Generator →

What is a Base64 QR Code?

A standard QR code stores plain text — a URL, a phone number, a message. A Base64 QR code stores a Base64-encoded string as the QR payload. The QR itself is just a regular QR code, but the data it carries is Base64-encoded rather than plain text.

This combination is useful when the data you want to transfer is already in Base64 format (like a JWT, API key, or encoded file), or when the receiving application expects Base64 input and you want to avoid manually copying a long string.

Why Encode to Base64 Before Making a QR?

There are several practical reasons to use Base64 as the QR payload instead of raw text:

  • Binary data: QR codes handle text, not raw bytes. Base64 converts binary data (images, encrypted values, arbitrary bytes) into a safe text string that QR codes can carry reliably.
  • Structured tokens: JWTs, OAuth tokens, and API keys are already Base64-encoded. Wrapping them in a QR lets mobile apps scan and import them directly — no manual input.
  • App compatibility: Some mobile SDKs, config importers, and internal tools expect Base64 input. Scanning a Base64 QR means the app can use the value immediately without a conversion step.
  • Special characters: Base64 output uses only alphanumeric characters and +/= — a safe character set that QR codes encode efficiently in alphanumeric mode.
  • Light obfuscation: While not security, Base64 prevents casual human reading of a printed QR code's data.

How to Generate a QR Code from Base64 Online

  1. Go to base64convert.org/base64-to-qr
  2. Type or paste your text into the input box — it encodes to Base64 instantly
  3. Click Generate QR — the QR code renders in your browser
  4. Click Download PNG to save the QR image

Everything happens client-side — no data is sent to any server. Works on desktop and mobile.

QR Code Size Limits

QR codes have a data capacity limit depending on the error correction level and content type:

Original text lengthBase64 length (~)QR scannable?
Up to ~500 chars~680 chars✅ Clean, easy to scan
500–1,500 chars~2,000 chars✅ Scannable, moderately dense
1,500–2,100 chars~2,800 chars⚠️ Dense — good lighting needed
Over 2,100 charsOver 2,900 chars❌ Exceeds QR limit

Our tool warns you automatically when output approaches or exceeds the limit.

Generate a Base64 QR Code in Python

import base64
import qrcode  # pip install qrcode[pil]

text = "Hello, World!"

# Step 1: Encode to Base64
b64 = base64.b64encode(text.encode("utf-8")).decode("utf-8")
print(f"Base64: {b64}")
# → SGVsbG8sIFdvcmxkIQ==

# Step 2: Generate QR from Base64 string
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_M)
qr.add_data(b64)
qr.make(fit=True)

img = qr.make_image(fill_color="black", back_color="white")
img.save("base64_qr.png")
print("QR saved to base64_qr.png")

Generate a Base64 QR Code in JavaScript (Node.js)

// npm install qrcode
const QRCode = require("qrcode");

const text = "Hello, World!";

// Step 1: Encode to Base64
const b64 = Buffer.from(text, "utf8").toString("base64");
console.log("Base64:", b64);
// → SGVsbG8sIFdvcmxkIQ==

// Step 2: Generate QR and save as PNG
QRCode.toFile("base64_qr.png", b64, {
  errorCorrectionLevel: "M",
  width: 300,
  margin: 2,
}, (err) => {
  if (err) throw err;
  console.log("QR saved to base64_qr.png");
});

// Or generate as Data URL (for browser/HTML embedding)
QRCode.toDataURL(b64, { width: 300 }, (err, url) => {
  console.log(url); // data:image/png;base64,...
});

Common Use Cases

  • Mobile app config import: Encode a JSON config string to Base64, generate a QR — the mobile app scans and imports it without manual entry
  • API key transfer: Encode an API key or secret to Base64, share via QR — the dev scans from their phone to their desktop clipboard
  • JWT inspection: Encode a JWT payload to Base64 QR for quick import into a mobile testing tool
  • Offline data sharing: Print Base64 QR codes to share encoded data without any internet connection
  • IoT device provisioning: Encode device credentials as Base64 QR for scanning during setup

Can Any QR Scanner Read It?

Yes — any standard QR scanner (phone camera, QR app) will read the code and return the Base64 string. However, the string won't automatically be decoded to plain text. The receiving app needs to run a Base64 decode step on the scanned value. This is why Base64 QR codes are most useful in developer workflows and app-to-app data transfer — not for end-user-facing URLs or messages.

Generate a Base64 QR code now — free

No sign-up, no install. Works entirely in your browser.

Open Base64 to QR Generator →

Frequently Asked Questions

What is a Base64 QR code?

A Base64 QR code is a QR code whose data payload contains a Base64-encoded string. Instead of storing plain text, the QR stores the Base64 representation of your data — useful for sharing binary data, encoded tokens, or structured strings between devices.

How do I generate a QR code from Base64 online?

Use base64convert.org/base64-to-qr — enter your text, it encodes to Base64 instantly, then click Generate QR. No sign-up, works entirely in your browser, and you can download the QR as a PNG.

What is the maximum data size for a Base64 QR code?

QR codes hold up to ~2,900 alphanumeric characters. Since Base64 expands data by ~33%, your original text should be under ~2,100 characters to produce a reliably scannable QR code. Longer inputs create denser QR codes that may fail to scan.

Can any QR scanner read a Base64 QR code?

Yes — any QR scanner will read the Base64 string. However, the receiving app needs to know it should decode the Base64 payload. Standard camera apps will just show the raw Base64 string. This technique is intended for apps or workflows that expect Base64 input.

Is Base64 QR code generation free?

Yes. Our Base64 to QR Code generator at base64convert.org/base64-to-qr is completely free, requires no sign-up, and processes everything in your browser — no data is sent to any server.