# JavaScript QR code libraries

JavaScript QR code libraries encode text or a URL as a QR code and render it as an image, an SVG, or terminal text. An encoder builds the matrix of dark and light modules before a renderer draws it. These libraries let apps print payment links, sign-in codes, and ticket codes that a phone camera can scan.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [qrcode](#node-qrcode) | 158.7M | 8.2K | Aug 2024 | MIT |
| [qrcode.react](#qrcode-react) | 55.3M | 4.3K | Dec 2024 | ISC |
| [toqr](#toqr) | 45.1M | 3 | Feb 2026 | MIT |
| [uqr](#uqr) | 38.3M | 795 | Apr 2026 | MIT |
| [qrcode-terminal](#qrcode-terminal) | 32.1M | 1.4K | Mar 2018 | Apache-2.0 |
| [qrcode-generator](#qrcode-generator) | 30.9M | 2.4K | Aug 2025 | MIT |
| [zxing-wasm](#zxing-wasm) | 20.2M | 298 | Nov 2026 | MIT |
| [antd](#antd) | 19.9M | 100.3K | Nov 2026 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[node-qrcode](#node-qrcode) has the most monthly downloads in this comparison, at 155.4M.

## Capabilities

| Library | Native SVG output | Native terminal text output |
| --- | --- | --- |
| [qrcode](#node-qrcode) | Yes | Yes |
| [qrcode.react](#qrcode-react) | Yes | No |
| [toqr](#toqr) | No | No |
| [uqr](#uqr) | Yes | Yes |
| [qrcode-terminal](#qrcode-terminal) | No | Yes |
| [qrcode-generator](#qrcode-generator) | Yes | Yes |
| [zxing-wasm](#zxing-wasm) | Yes | Yes |
| [antd](#antd) | Yes | No |

## Libraries

### qrcode

[GitHub](https://github.com/soldair/node-qrcode) · [npm](https://www.npmjs.com/package/qrcode) · [Docs](https://cdn.jsdelivr.net/npm/qrcode@1.5.4/README.md)

Encodes QR images in Node or browsers with automatic mixed-mode segmentation.

- Downloads / mo: 158.7M
- Stars: 8.2K
- Last release: 1.5.4
- License: MIT
- Capabilities: [From the qrcode docs](https://cdn.jsdelivr.net/npm/qrcode@1.5.4/README.md)

**Strengths**

- **Optimizes mixed content automatically.** Automatic segments combine encoding modes to reduce the symbol size.
- **Accepts raw byte payloads.** Pass typed arrays or Buffers instead of converting bytes to strings.

**Watch out for**

- **Strings can change binary payloads.** Use byte arrays or Buffers to preserve binary input.
- **Kanji optimization needs a helper.** Supply toSJISFunc for dedicated Kanji-mode encoding.

```sh
npm install qrcode@1.5.4
```

**CorentinTh/it-tools** (41.3K stars)

[CorentinTh/it-tools](https://github.com/CorentinTh/it-tools) 

```javascript
export function useQRCode({
  text,
  color: { background, foreground },
  errorCorrectionLevel,
  options,
}: {
  text: MaybeRef<string>
  color: { foreground: MaybeRef<string>; background: MaybeRef<string> }
  errorCorrectionLevel?: MaybeRef<QRCodeErrorCorrectionLevel>
  options?: QRCodeToDataURLOptions
}) {
  const qrcode = ref('');

  watch(
    [text, background, foreground, errorCorrectionLevel].filter(isRef),
    async () => {
      if (get(text)) {
        qrcode.value = await QRCode.toDataURL(get(text).trim(), {
          color: {
            dark: get(foreground),
            light: get(background),
            ...options?.color,
          },
          errorCorrectionLevel: get(errorCorrectionLevel) ?? 'M',
          ...options,
        });
      }
    },
    { immediate: true },
  );

  return { qrcode };
}

```

[src/tools/qr-code-generator/useQRCode.ts](https://github.com/CorentinTh/it-tools/blob/d505845f918e946ec300af7b36efc107e2f66e9e/src/tools/qr-code-generator/useQRCode.ts) · [More projects using qrcode →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20qrcode%20to%20generate%20QR%20images&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
const QRCode = require('qrcode');
QRCode.toString('Hello world', { type: 'terminal' }, (error, output) => {
  if (error) throw error;
  console.log(output);
});

```

From [README.md](https://cdn.jsdelivr.net/npm/qrcode@1.5.4/README.md)

### qrcode.react

[GitHub](https://github.com/zpao/qrcode.react) · [npm](https://www.npmjs.com/package/qrcode.react) · [Docs](https://cdn.jsdelivr.net/npm/qrcode.react@4.2.0/README.md)

Generates QR codes as a React component.

- Downloads / mo: 55.3M
- Stars: 4.3K
- Last release: 4.2.0
- License: ISC
- Capabilities: [From the qrcode.react docs](https://cdn.jsdelivr.net/npm/qrcode.react@4.2.0/README.md)

```sh
npm install qrcode.react@4.2.0 react@19.2.0 react-dom@19.2.0
```

**ohcnetwork/care_fe** (690 stars)

[ohcnetwork/care_fe](https://github.com/ohcnetwork/care_fe) 

```tsx
/** Typst can't draw QR codes: render `element` and pass `files` to the preview. */
export function useQrCode(value: string, path: string, size: number) {
  const ref = useRef<SVGSVGElement>(null);
  const [bytes, setBytes] = useState<Uint8Array>();

  useEffect(() => {
    if (!ref.current) return;
    const svg = ref.current.cloneNode(true) as SVGSVGElement;
    roundFinders(svg);
    setBytes(serializeSvg(svg));
  }, [value]);

  return {
    element: (
      <div hidden>
        <QRCodeSVG ref={ref} value={value} size={size} marginSize={0} />
      </div>
    ),
    files: bytes ? { [path]: bytes } : undefined,
    ready: !!bytes,
  };
}

```

[src/print/useQrCode.tsx](https://github.com/ohcnetwork/care_fe/blob/5ee965805cafd25413d285a975f055516da2d8b7/src/print/useQrCode.tsx#L31-L52) · [More projects using qrcode.react →](https://dashboard.exa.ai/playground/search?q=qrcode.react%20GitHub%20projects)

**Quickstart**

```tsx
import { QRCodeSVG } from 'qrcode.react';

export default function App() {
  return <QRCodeSVG value="Hello world" />;
}

```

From [README.md](https://cdn.jsdelivr.net/npm/qrcode.react@4.2.0/README.md)

### toqr

[GitHub](https://github.com/kitten/toqr) · [npm](https://www.npmjs.com/package/toqr) · [Docs](https://cdn.jsdelivr.net/npm/toqr@0.1.1/dist/toqr.d.ts)

Encodes QR codes in a small package.

- Downloads / mo: 45.1M
- Stars: 3
- Last release: 0.1.1
- License: MIT
- Capabilities: [From the toqr docs](https://cdn.jsdelivr.net/npm/toqr@0.1.1/dist/toqr.d.ts)

```sh
npm install toqr@0.1.1
```

**expo/expo** (53.7K stars)

[expo/expo](https://github.com/expo/expo) 

```javascript
export function printQRCode(url: string): QROutput {
  const qr = toQR(url);
  const output = supportsSextants() ? createSextantOutput(qr) : createHalfblockOutput(qr);
  return {
    lines: output.split('\n').length,
    print() {
      Log.log(output);
    },
  };
}

```

[packages/@expo/cli/src/utils/qr.ts](https://github.com/expo/expo/blob/345722d466120e88670cbdca3cc50b018b5463b5/packages/@expo/cli/src/utils/qr.ts) · [More projects using toqr →](https://dashboard.exa.ai/playground/search?q=toqr%20GitHub%20projects)

**Quickstart**

```javascript
import { toQR } from 'toqr';
console.log(toQR('Hello world'));

```

From [toqr.d.ts](https://cdn.jsdelivr.net/npm/toqr@0.1.1/dist/toqr.d.ts)

### uqr

[GitHub](https://github.com/unjs/uqr) · [npm](https://www.npmjs.com/package/uqr) · [Docs](https://cdn.jsdelivr.net/npm/uqr@0.1.3/README.md)

Generates QR codes in any runtime as ANSI, Unicode, or SVG.

- Downloads / mo: 38.3M
- Stars: 795
- Last release: 0.1.3
- License: MIT
- Capabilities: [From the uqr docs](https://cdn.jsdelivr.net/npm/uqr@0.1.3/README.md)

```sh
npm install uqr@0.1.3
```

**nuxt/cli** (403 stars)

[nuxt/cli](https://github.com/nuxt/cli) 

```javascript
export async function printQRCode(url: string, { showURL = false }: { showURL?: boolean } = {}): Promise<void> {
  const { renderUnicodeCompact } = await import('uqr')
  const caption = showURL ? `\n${centerBlock(styleText('cyan', url), url.length)}` : ''
  // eslint-disable-next-line no-console
  console.log(`\n${centerBlock(renderUnicodeCompact(url))}${caption}\n`)
}

```

[packages/nuxt-cli/src/dev/listen.ts](https://github.com/nuxt/cli/blob/33e2c2c34a124c2f3326072e51880af71ba4b542/packages/nuxt-cli/src/dev/listen.ts) · [More projects using uqr →](https://dashboard.exa.ai/playground/search?q=uqr%20GitHub%20projects)

**Quickstart**

```javascript
import { renderSVG } from 'uqr';
console.log(renderSVG('Hello world'));

```

From [README.md](https://cdn.jsdelivr.net/npm/uqr@0.1.3/README.md)

### qrcode-terminal

[GitHub](https://github.com/gtanner/qrcode-terminal) · [npm](https://www.npmjs.com/package/qrcode-terminal)

Prints QR codes in the terminal.

- Downloads / mo: 32.1M
- Stars: 1.4K
- Last release: 0.12.0
- License: Apache-2.0
- Capabilities: [From the qrcode-terminal docs](https://github.com/gtanner/qrcode-terminal)

```sh
npm install qrcode-terminal@0.12.0
```

**hjyssg/ShiguReader** (418 stars)

[hjyssg/ShiguReader](https://github.com/hjyssg/ShiguReader) 

```javascript
async function printIP() {
    console.log("----------------------------------------------------------------");
    console.log(dateFormat(new Date(), "yyyy-mm-dd HH:MM"));
    console.log(`Express Server listening on port ${port}`);
    console.log("You can open ShiguReader from Browser now!");
    console.log(`http://localhost:${port}`);

    try {
        if (printQrCode) {

            const ip = await getIP();
            console.log(ip);
            console.log("Scan the QR code to open on mobile devices");
            qrcode.generate(ip);
        }
    } catch (e) {
        //nothing
    }
    console.log("----------------------------------------------------------------");
}

```

[packages/backend/src/app.js](https://github.com/hjyssg/ShiguReader/blob/d352dd539f836e50a2c49dfc83bf36666ec429fd/packages/backend/src/app.js) · [More projects using qrcode-terminal →](https://dashboard.exa.ai/playground/search?q=qrcode-terminal%20GitHub%20projects)

**Quickstart**

```javascript
const qrcode = require('qrcode-terminal');
qrcode.generate('Hello world');

```

From [README.md](https://github.com/gtanner/qrcode-terminal)

### qrcode-generator

[GitHub](https://github.com/kazuhikoarase/qrcode-generator) · [npm](https://www.npmjs.com/package/qrcode-generator) · [Docs](https://cdn.jsdelivr.net/npm/qrcode-generator@2.0.4/README.md)

Builds QR matrices and returns SVG, image-tag or text representations.

- Downloads / mo: 30.9M
- Stars: 2.4K
- Last release: 2.0.4
- License: MIT
- Capabilities: [From the qrcode-generator docs](https://cdn.jsdelivr.net/npm/qrcode-generator@2.0.4/README.md)

**Strengths**

- **Exposes individual QR modules.** Inspect matrix size and dark cells after building the symbol.
- **Can auto-select symbol size.** Pass a zero type number to select the QR version automatically.

**Watch out for**

- **Multibyte text needs encoder configuration.** Configure stringToBytes for multibyte character encodings.

```sh
npm install qrcode-generator@2.0.4
```

**anthropics/cwc-workshops** (2.3K stars)

[anthropics/cwc-workshops](https://github.com/anthropics/cwc-workshops) 

```javascript
() => {
  const qr = qrcode(0, 'M');
  qr.addData(REPO_URL);
  qr.make();
  return qr.createSvgTag({ cellSize: 4, margin: 0, scalable: true });
}

```

[agent-battle/event/server.mjs](https://github.com/anthropics/cwc-workshops/blob/2c65d16c6de16f8f24117d539a712ea706b5dee7/agent-battle/event/server.mjs) · [More projects using qrcode-generator →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20qrcode-generator%20to%20generate%20QR%20images&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
const qrcode = require('qrcode-generator');
const qr = qrcode(0, 'M');
qr.addData('Hello world');
qr.make();
console.log(qr.createSvgTag());

```

From [README.md](https://cdn.jsdelivr.net/npm/qrcode-generator@2.0.4/README.md)

### zxing-wasm

[GitHub](https://github.com/Sec-ant/zxing-wasm) · [npm](https://www.npmjs.com/package/zxing-wasm) · [Docs](https://github.com/sec-ant/zxing-wasm)

Packages ZXing-C++ as a typed WebAssembly module.

- Downloads / mo: 20.2M
- Stars: 298
- Last release: 3.1.7
- License: MIT
- Capabilities: [From the zxing-wasm docs](https://github.com/sec-ant/zxing-wasm)

```sh
npm install zxing-wasm@3.1.7
```

**infrost/RaptorQR** (178 stars)

[infrost/RaptorQR](https://github.com/infrost/RaptorQR) 

```javascript
export async function writeQRCodeSymbolWithZXing(
  data: Uint8Array,
  version: number,
  eccLevel: EccLevel,
  scale: number,
): Promise<BarcodeSymbol> {
  validateQRCodeRenderOptions(version, eccLevel, scale, data.length);
  await prepareWriter();

  const options: WriterOptions = {
    format: 'QRCode',
    options: `version=${version},ecLevel=${eccLevel}`,
    scale,
    addQuietZones: true,
    addHRT: false,
  };
  const result = await writeBarcode(data, options);

  if (result.error) {
    throw new Error(`ZXing QR writer failed: ${result.error}`);
  }

  return result.symbol;
}

```

[packages/raptorqr-core/src/qr/qr_write_wasm.ts](https://github.com/infrost/RaptorQR/blob/fdb434e1fc1126f84b98e407be8d24bbb683b597/packages/raptorqr-core/src/qr/qr_write_wasm.ts#L57-L80) · [More projects using zxing-wasm →](https://dashboard.exa.ai/playground/search?q=zxing-wasm%20GitHub%20projects)

**Quickstart**

```javascript
const { readFileSync } = require('node:fs');
const { prepareZXingModule, writeBarcode } = require('zxing-wasm/writer');
const bytes = new Uint8Array(readFileSync(require.resolve('zxing-wasm/writer/zxing_writer.wasm')));
prepareZXingModule({ overrides: { wasmBinary: bytes.buffer } });
writeBarcode('Hello world', { format: 'QRCode' }).then(output => console.log(output.svg));

```

From [README.md](https://github.com/sec-ant/zxing-wasm)

### antd

[GitHub](https://github.com/ant-design/ant-design) · [npm](https://www.npmjs.com/package/antd) · [Docs](https://ant.design/components/qr-code/)

Provides an enterprise-class React UI component library.

- Downloads / mo: 19.9M
- Stars: 100.3K
- Last release: 6.7.1
- License: MIT
- Capabilities: [From the antd docs](https://ant.design/components/qr-code/)

```sh
npm install antd@6.7.1 react@19.2.0 react-dom@19.2.0
```

**Worklenz/worklenz** (3.3K stars)

[Worklenz/worklenz](https://github.com/Worklenz/worklenz) 

```tsx
const MobileAppModal = ({ open, onClose }: MobileAppModalProps) => {
  const { t } = useTranslation('settings/mobile-app');
  const themeMode = useAppSelector((state: RootState) => state.themeReducer.mode);
  const isDark = themeMode === 'dark';

  return (
    <Modal
      open={open}
      onCancel={onClose}
      title={
        <Typography.Title level={4} style={{ marginBlockEnd: 0 }}>
          {t('modalTitle')}
        </Typography.Title>
      }
      footer={null}
      centered
      destroyOnHidden
      width={360}
    >
      <Flex vertical align="center" gap={20} style={{ paddingBlock: 16 }}>
        <QRCode
          value={WORKLENZ_MOBILE_APP_URL}
          size={180}
          color={isDark ? '#ffffff' : '#000000'}
          bgColor={isDark ? '#1f1f1f' : '#ffffff'}
        />

        <Flex gap={12} justify="center" wrap>
          <a href={WORKLENZ_APP_STORE_URL} target="_blank" rel="noopener noreferrer">
            <img
              src="/img/app-store-badge.svg"
              alt={t('appStoreBadgeAlt')}
              style={{ height: 40 }}
              onError={e => {
                (e.currentTarget as HTMLImageElement).style.display = 'none';
              }}
            />
          </a>
          <a href={WORKLENZ_GOOGLE_PLAY_URL} target="_blank" rel="noopener noreferrer">
            <img
              src="/img/google-play-badge.png"
              alt={t('googlePlayBadgeAlt')}
              style={{ height: 40 }}
              onError={e => {
                (e.currentTarget as HTMLImageElement).style.display = 'none';
              }}
            />
          </a>
        </Flex>
      </Flex>
    </Modal>
  );
};

```

[worklenz-frontend/src/components/mobile-app/MobileAppModal.tsx](https://github.com/Worklenz/worklenz/blob/6693acc7e0db2da98152428fded26eea11420723/worklenz-frontend/src/components/mobile-app/MobileAppModal.tsx#L16-L68) · [More projects using antd →](https://dashboard.exa.ai/playground/search?q=antd%20GitHub%20projects)

**Quickstart**

```tsx
import { QRCode } from 'antd';

export default function App() {
  return <QRCode value="Hello world" />;
}

```

From [README.md](https://ant.design/components/qr-code/)

## FAQ

### Which JavaScript QR code library should I use?

[qrcode](#node-qrcode) suits Node.js and browser code that needs PNG, data URL, SVG, or terminal output. [qrcode.react](#qrcode-react) suits React apps that render a QR code as a component. [qrcode-terminal](#qrcode-terminal) suits command-line tools that print a code in the terminal.

### How do I generate a QR code in React?

[qrcode.react](#qrcode-react) renders a QR code as a React component with an SVG or canvas renderer. Apps that already use Ant Design can use the QR code component in [antd](#antd).

### What is uqr?

[uqr](#uqr) generates QR codes in any JavaScript runtime as SVG, ANSI, or Unicode text. It also returns the raw QR matrix for custom renderers.

### What is zxing-wasm?

[zxing-wasm](#zxing-wasm) packages the ZXing-C++ barcode library as a WebAssembly module. Its writer supports QR codes and other barcode formats, with SVG, PNG, and terminal text output.

### What is qrcode-generator?

[qrcode-generator](#qrcode-generator) is a low-level QR code object with explicit steps to add data and build the code. It returns SVG, ASCII, GIF, canvas, or matrix output.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript QR code libraries node-qrcode qrcode-generator QR Code Styling qr-image code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
