Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To generate a boarding pass barcode in JavaScript, you assemble an IATA Bar Coded Boarding Pass (BCBP) payload as a fixed-order text string defined by IATA Resolution 792, then render that string with a barcode library. For a printed pass, the IATA default symbology is PDF417. The output is a synthetic test artifact. It shows that your payload is structured and scannable, but it does not make a pass valid for travel or acceptable to any airline.

BCBP is the payload; PDF417 is the symbology that carries it

Most confusion in this topic comes from treating the data and the barcode as one thing. BCBP is the structured data message that describes the passenger, the booking reference, and each flight leg. The symbology is the printed or displayed pattern that encodes those characters, along with its own error correction and reading rules. You choose the two independently, though not without limits, because the standard defines which symbologies are permitted for which kind of pass.

Aspect IATA BCBP Symbology (PDF417, Aztec, Data Matrix, QR)
What it answers What the pass says: passenger, PNR, legs, seat, sequence How the characters are drawn and read
Defined by IATA Resolution 792 Each symbology’s own specification
Changing it Changes the characters that must be re-encoded and re-checked Changes the image and scanner settings, not the fields
Typical role on a pass The meaning of the barcode The carrier of that meaning

So a QR code is not “a BCBP code” by itself. A QR code can carry a BCBP string, and so can PDF417. The question you need to answer first is what the payload must contain. The second question is which symbology the pass context allows.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Standards facts to pin down before you code

IATA’s common-use standards page states the following. The printed-pass default is a two-dimensional PDF417 barcode containing a structured data message. IATA’s BCBP group of experts maintains and updates Resolution 792. The page also states: “Version 8 of the resolution became effective on June 1, 2020.” Later revisions may have been issued since that page was written, so check IATA’s current publications before you rely on any version-specific rule.

#1 Best Overall
Sale
Tera Barcode Scanner Wireless 1D Laser Cordless Barcode Reader with Battery Level Indicator, Versatile 2 in 1 2.4Ghz Wireless and USB 2.0 Wired
  • Larger battery enables longer continuous usage and twice the stand-by time. With the unique battery indicator light showing the remaining battery level, no more Low Battery Anxiety.
  • The curved handle is extended and widened. With specially designed smooth and flat trigger for a better grip.
  • The orange anti shock silicone protective cover can prevent scratches and friction even when dropped from up to 6.56 feet. IP54 technology protects the wireless barcode scanner from dust.
  • Plug and play with the USB receiver or the USB cable, no driver installation needed. Easy and quick to set up. Wireless transmission distance reaches up to 328 ft. in barrier free environment.
  • Supports almost all 1D Barcodes: Febraban Bank Code, Codabar, Code 11, Code93, MSI, Code 128, EAN-128, Code 39, EAN-8, EAN-13, UPC-A, ISBN, Industrial 25, Interleaved 25, Standard 25, Matrix. Reads damaged, fuzzy, reflective and smudged barcodes.
Version Effective date (per IATA) What matters for a developer
Version 7 June 1, 2018 Allowed printed passes to use Aztec, Data Matrix, or QR at airline request. Matrix formats were already used for electronic and mobile passes.
Version 8 June 1, 2020 The version IATA’s standards page identifies as effective on that date. Confirm it is still the current version before implementation.

The version determines which field definitions and symbology options apply. Use the version your target airline or implementation guide names, not the one in an older tutorial.

Step 1: Set up a Node.js or browser project

  1. Create a project folder and initialise it with npm init -y.
  2. Install the barcode library with npm install bwip-js.
  3. For browser use, bundle the library with your build tool (for example Vite or webpack) and import it as a module. Node.js scripts can import it directly.

Step 2: Assemble the payload in its prescribed order

BCBP is not a set of tagged key-value pairs. Each field occupies a fixed position and width, and the sections appear in a fixed sequence. Padding is part of the value. The mandatory fields below are the minimum for a single-leg pass.

Rank #2
WoneNice USB Laser Barcode Scanner Wired Handheld Bar Code Scanner Reader Black
  • Plug and play, This laser handheld barcode scanner has simple installation with any USB port and Ideal for businesses, shops and warehouse operations. Its function is unbeatable and easy to use, design is stylish
  • Compatible with Windows, Mac, and Linux; works with Word, Excel, Novell, and all common software
  • Scanning Speed: 200 scans per second. Scanning angle: Inclination angle 55°, Elevation angle 65°. Operational Light Source:Visible Laser 650-670nm.
  • Decode Capability: Code11, Code39, Code93, Code32, Code128, Coda Bar, UPC-A, UPC-E, EAN-8, EAN-13, ISBN/ISSN, JAN.EAN/UPC Add-on2/5 MSI/Plessey, Telepen and China Postal Code,Interleaved 2 of 5, Industrial 2 of 5, Matrix 2 of 5, etc ; 300 configurable options for prefix, suffix and termination strings, support turn on/off the beep.
  • Color: Black. Dimensions: 3.6 x 2.6 x 6.1 inches. Type of Cable: 2M or 6ft straight cable. Shock: 1.5m drop on concrete surface. Regulatory Approvals: FCC CE.

Unique mandatory section (23 characters)

Field Width Example value
Format code 1 M
Number of legs encoded 1 1
Passenger name (LAST/FIRST, space-padded) 20 DOE/JOHN
Electronic ticket indicator 1 E

Repeated mandatory leg section (37 characters per leg)

Field Width Example value
Operating carrier PNR code 7 ABC123
From city airport code 3 LHR
To city airport code 3 JFK
Operating carrier designator 3 BA
Flight number 5 117
Date of flight (Julian day of year) 3 100
Compartment code 1 Y
Seat number 4 012A
Check-in sequence number 5 00001
Passenger status 1 0
Field size of following variable data (hexadecimal) 2 00

Size fields

The two-character hexadecimal size fields tell a reader how many bytes of optional data follow. Calculate them from the length of the data you actually assemble, never by estimate. A size of 00 means no variable data follows that leg. The code below sets it to zero, which is valid only for a pass with no conditional sections. A conformant issuer must add the version and conditional sections exactly as Resolution 792 defines them and recalculate every size field from that data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build the payload

// bcbp.js (Node.js, ES module)
const pad = (value, width) => String(value).toUpperCase().padEnd(width, ' ').slice(0, width);
const hex2 = (n) => n.toString(16).toUpperCase().padStart(2, '0');

export function buildBcbp({ name, pnr, from, to, carrier, flight, julianDate, compartment, seat, sequence, status, legVariableLength = 0 }) {
  const unique = 'M' + '1' + pad(name, 20) + 'E';                      // 23 characters
  const leg =
    pad(pnr, 7) + pad(from, 3) + pad(to, 3) + pad(carrier, 3) +
    pad(flight, 5) + String(julianDate).padStart(3, '0') +
    pad(compartment, 1) + pad(seat, 4) +
    String(sequence).padStart(5, '0') + pad(status, 1) +
    hex2(legVariableLength);                                           // 37 characters
  return unique + leg;
}

const payload = buildBcbp({
  name: 'DOE/JOHN', pnr: 'ABC123', from: 'LHR', to: 'JFK', carrier: 'BA',
  flight: '117', julianDate: 100, compartment: 'Y', seat: '012A', sequence: 1, status: '0',
});
console.log(payload.length, payload); // 60 characters for a single leg with no variable data

Step 3: Render only after the payload is complete

Render the string once the payload is finished and checked. The payload must be ASCII text. The examples below use bwip-js, which supports PDF417 and the matrix symbologies.

Rank #3
Eyoyo EYH2 Handheld USB Wired 2D 1D Barcode Scanner for POS Mobile Payment
  • Continuous Usage All Day: The EY-H2 USB barcode scanner is designed to always be ready for the next scan, which significantly reduces downtime and repair costs; it shortens checkout lines, improves customer service, and boosts business productivity
  • Plug and Play: Eyoyo wired barcode scanner is connected via a USB cable, with no need to install any driver or software; It offers effortless connection and is compatible with Windows, Mac, Android, and Linux; Seamlessly works with Quickbook, Word, Excel, Novell, and all common software
  • Supports Multiple 1D/2D Barcodes: Eyoyo QR code scanner scan with most 1D 2D barcodes with ease; 1D Barcodes: EAN, UPC, Code 39, Code 93, Code 128, UCC/EAN 128, Codabar, Interleaved 2 of 5, ITF-6, ITF-14, ISBN, ISSN, MSI-Plessey, GS1 Databar, Code 11, Industrial 25, Matrix 2 of 5, etc. 2D Barcodes: QR, DataMatrix, PDF417, and so on
  • Supports Screen Scanning: The Eyoyo 2D scanner is capable of reading barcodes from smartphone screens, such as mobile coupons, digital wallets, and digital loyalty cards; Before scanning, simply turn your screen brightness to the maximum
  • Sturdy Anti-Shock and Durable Design: The Eyoyo 2D barcode scanner features an ergonomic design made of high-quality ABS, enabling it to withstand repeated drops from 5 ft/1.5 m high onto the concrete ground; The durable plastic material ensures a long service life

In the browser, draw to a canvas element:

import bwipjs from 'bwip-js';
import { buildBcbp } from './bcbp.js';

const payload = buildBcbp({ name: 'DOE/JOHN', pnr: 'ABC123', from: 'LHR', to: 'JFK', carrier: 'BA',
  flight: '117', julianDate: 100, compartment: 'Y', seat: '012A', sequence: 1, status: '0' });

bwipjs.toCanvas(document.getElementById('pass'), {
  bcid: 'pdf417',
  text: payload,
  scale: 2,
  height: 12,
});

In Node.js, write a PNG file for scanner testing:

import bwipjs from 'bwip-js';
import { writeFileSync } from 'node:fs';
import { buildBcbp } from './bcbp.js';

const payload = buildBcbp({ name: 'DOE/JOHN', pnr: 'ABC123', from: 'LHR', to: 'JFK', carrier: 'BA',
  flight: '117', julianDate: 100, compartment: 'Y', seat: '012A', sequence: 1, status: '0' });

const png = await bwipjs.toBuffer({ bcid: 'pdf417', text: payload, scale: 3, height: 10 });
writeFileSync('test-boarding-pass.png', png);

Step 4: Choose the symbology deliberately

Changing the bcid does not change the payload, but it must match the pass context. PDF417 is the IATA default for a printed pass. The matrix formats are permitted for printed passes only when the airline requests them, under the version 7 provisions described above.

Symbology bwip-js bcid Where IATA’s standards page places it
PDF417 pdf417 Default for a printed pass
Aztec azteccode Printed pass at airline request (version 7 provisions); matrix formats already used for electronic and mobile passes
Data Matrix datamatrix As for Aztec
QR qrcode As for Aztec
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Step 5: Validate structure and readability as separate checks

A barcode can be scannable and still carry the wrong fields. Another barcode can have perfect fields and fail to scan at a small module size. Run both checks.

Rank #4
NETUM Bluetooth Barcode Scanner, Support 2.4G Wireless & Bluetooth & Wired Connect Smart Phone, Tablet, PC, CCD Bar Code Reader Work with Windows, Mac,Android (NT-1228BC)
  • Widely Compatible: Bluetooth Barcode Scanner for iPhone iPad Android Tablet PC, Support HID / SPP / BLE mode via bluetooth, Work with Windows XP/7/8/10, Mac OS, Windows Mobile, Android OS, iOS, Linux.
  • Strong Recognition Ability: With the 2500 pixels high-resolution CCD sensor Engine, Rapidly decodes all 1D and stacked barcodes (including ISBN book), even worn, damaged or tightly spaced codes. Scan 1D codes directly from paper or screen, such as a computer monitor, smartphone, or tablet, or scan through glass surfaces, plastic shrink wrap, a CCD scanner is likely the best way to go.
  • Automatic Scanning: NT-1228bc barcode scanner have three scanning modes: manual trigger mode, continuous scanning mode and auto-sensing scanning mode. In addition, there is a storage mode. Storage mode can be used when you are out of range of Bluetooth and wireless connectivity. Supports storage of up to 100,000 barcodes. Note: Before use, you need to scan the corresponding setting barcode on the manual.
  • 2600mAh Battery Upgraded: Continuous scanning up to 200,000 times on a full charge. After a full charge the scanner can be used for one month at least, even in warehouses and at pos checkout counters where scanners are frequently used. In libraries and hospitals it can be used even longer.
  • Programmable Configuration: Add custom prefixes/ suffixes, delete characters, Add keyboard keys/ combinations (terminator TAB, CR&LF, Home etc.), Enable or disable the barcode type as you want. Buzzer can be set to mute to allow for a quiet operation.(Note: It does not work with square POS / Divalto / DoorDash / Lightspeed POS system)
Check How you run it What it catches What it does not establish
Parser self-check Slice the string at the fixed offsets and compare each field with the input Wrong widths, misordered fields, bad padding, incorrect size fields Whether a scanner can read the image, or whether an airline accepts the pass
Scanner decode Decode the PNG or printed output with a PDF417-capable barcode scanner or decoder library, then compare the decoded text with the payload Rendering faults, insufficient module size, quiet-zone problems Whether the fields meet the standard

The parser below covers the 60-character single-leg payload from Step 2. Extend the offsets when you add conditional sections.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const fields = [
  ['format', 0, 1], ['legs', 1, 2], ['name', 2, 22], ['eTicket', 22, 23],
  ['pnr', 23, 30], ['from', 30, 33], ['to', 33, 36], ['carrier', 36, 39],
  ['flight', 39, 44], ['julianDate', 44, 47], ['compartment', 47, 48],
  ['seat', 48, 52], ['sequence', 52, 57], ['status', 57, 58], ['legVariableSize', 58, 60],
];

export function parseBcbp(text) {
  const out = {};
  for (const [key, start, end] of fields) out[key] = text.slice(start, end).trim();
  return out;
}

const parsed = parseBcbp(payload);
console.assert(parsed.name === 'DOE/JOHN', 'name field mismatch');
console.assert(parsed.legVariableSize === '00', 'size field mismatch');

For the scanner check, the decoded text should match the payload character for character, including the padding spaces. A mismatch in padding is a real error, even though the barcode scans.

Best Value
NetumScan USB 1D Barcode Scanner, Handheld Wired CCD Barcode Reader (1)
  • CCD Image Scanning Technology - NetumScan 1D barcode reader is equiped with advanced CCD sensor, which can quick capture 1D codes from paper and screen, including CODE128, UPC/EAN Add on 2 or 5, that can read even deformed barcodes, i.e. smudged, damaged, fuzzy, reflective barcodes, etc. Reading faster and more accurate than laser scanner.
  • Sturdy Anti-shock and Durable Design - Ergonomic design with high-quality ABS making it can support withstand repeated drops from 2m high to the concrete ground, durable to use. Durable plastic material guarantees long service life.
  • Three scanning mode - Key trigger mode + Auto-induction mode + Continuous Mode. There is no need to pull the trigger in auto-sensing mode and continuous scanning. Sometimes the self-sensing scanning function is in the inactive stage, please contact us and be at your service at any time.
  • Supported 1D Bar Code - 1D Decode Capability: UPC-A, UPC-E, EAN-8, EAN-13, ISSN, ISBN, Code 128, GS1-128, Code39, Code93,Code32, Code11, UCC/EAN128, Interleaved 2 of 5, Industrial 2 of 5, Codabar(NW-7), MSI, Plessey, RSS, China Post, etc.
  • Widely Use Range - This NetumScan Handheld USB barcode scanner can be used in supermarkets, convenience stores, warehouse, library, bookstore, drugstore, retail shop for file management, inventory tracking and POS(point of sale), etc.

What a passing test does not establish

  • Airline acceptance. The standard defines the data format. Each airline decides what it reads at check-in and boarding, and the sources used here do not establish any airline’s specific requirements.
  • Scanner compatibility. Not every barcode scanner is configured for PDF417 or for each matrix symbology. Confirm your scanner’s supported formats before reading a failed decode as a payload error.
  • Production readiness. A production issuer needs the current Resolution 792 and its implementation guide, the full conditional sections for its pass types, and data from its own reservation and departure systems. The values in this example are invented.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.