October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

How to Generate a Boarding Pass Barcode in JavaScript (IATA BCBP)

You can generate a synthetic IATA BCBP barcode in JavaScript by assembling the payload in the order IATA Resolution 792 prescribes, rendering it with bwip-js, and checking it with a parser and a scanner. A barcode that scans is not thereby a valid travel document.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To generate a boarding pass barcode in JavaScript, you build a BCBP (Bar Coded Boarding Pass) payload string in the fixed order defined by IATA Resolution 792, then render that string with a barcode library. For a printed pass, IATA’s default symbology is PDF417. The output is a synthetic test artifact: it can exercise your parser and a scanner, but a successful scan does not make it a valid boarding pass for travel or proof that an airline will accept it.

Keep the payload and the symbology separate

Most confusion in this area comes from treating “BCBP” and “QR code” as competing formats. They operate at different layers. BCBP is the structured data message: which passenger, which flight, which seat, and which sections follow. The symbology is the printed or displayed pattern that carries those characters. The same payload can, in principle, be drawn as different symbologies, subject to what the airline and the pass context allow.

As an Amazon Associate I earn from qualifying purchases.

Layer What it is Defined by What changes if you swap it
BCBP payload A fixed-order text message with mandatory and conditional sections, fixed widths, padding, and hexadecimal size fields IATA Resolution 792 and its implementation guide Nothing about the symbology; the field layout must still conform
PDF417 A stacked two-dimensional symbology IATA’s default for printed passes Only how the characters are drawn
Aztec, Data Matrix, QR Matrix two-dimensional symbologies Allowed for printed passes at airline request under later versions, and already used for electronic and mobile passes Only how the characters are drawn; acceptance depends on the airline

So the question “What is the difference between IATA BCBP and a QR code?” has a precise answer: BCBP is the message, and a QR code is one way to print it. A QR code that contains arbitrary text is not a BCBP barcode.

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

Start from the standard, not from a tutorial

IATA’s common-use standards page describes Resolution 792 as the document that defines the boarding-pass data elements and their format. The page states: “Version 8 of the resolution became effective on June 1, 2020.” It attributes maintenance of Resolution 792 to IATA’s BCBP group of experts. Treat version 8, effective June 1, 2020, as the most recent version we can point to from IATA’s published material. Check IATA for any later revision before you build a production issuer.

#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.

Tutorials and demo code are useful for implementation patterns, but they are not normative. Every field width, padding rule, and size definition in your code should be traced back to the standard itself.

  • A current copy of IATA Resolution 792 and its implementation guide, matched to the version you target
  • Node.js or a modern browser environment, with the bwip-js package installed from npm
  • A PDF417-capable scanner or decoder for the validation step
  • A decision on which sections your test pass needs: mandatory only, or mandatory plus conditional sections

Step 1: Transcribe the field table

Create one ordered specification that lists each mandatory field, its width, and its padding direction exactly as the standard gives them. Keep it as data, not as scattered string literals, so you can reuse it for both assembly and parsing. The order is part of the format. A correct set of values in the wrong order is an invalid payload.

The mandatory section is fixed-width. Each field occupies a set number of characters, and short values are padded to that width. Do not trim values to fit a guess; if a value exceeds its width, reject it and report the field name.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Step 2: Assemble the payload

Build the string in three passes: the fixed mandatory fields, the size fields, and any conditional sections. The two hexadecimal size fields are the most common source of failures. Each one counts characters that come after it, so it can only be computed once that following block is complete.

Fixed-width helper

function fixed(value, width) {
  const s = String(value).toUpperCase();
  if (s.length > width) {
    throw new RangeError(`"${s}" exceeds ${width} characters`);
  }
  return s.padEnd(width, ' ');
}

Hexadecimal size field

function hexSize(length) {
  if (length > 0xff) {
    throw new RangeError(`Section of ${length} characters does not fit in two hex digits`);
  }
  return length.toString(16).toUpperCase().padStart(2, '0');
}

Use uppercase hexadecimal consistently and always write exactly two characters. Confirm in the standard how the size is counted for each section, since the count must match what your parser will measure.

Assembly sketch

// spec: the ordered [name, width] pairs transcribed from Resolution 792
function buildMandatory(spec, values) {
  return spec.map(([name, width]) => fixed(values[name] ?? '', width)).join('');
}

// Compute the size field only after the following block is complete
function withSizeField(followingBlock) {
  return hexSize(followingBlock.length) + followingBlock;
}

Keep the function names and the way you thread values through them as your own design. The point is the sequence: fields in spec order, padding applied per field, sizes computed last.

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

Step 3: Render the payload with bwip-js

Render only after the payload is complete and has passed your own checks. bwip-js can draw to a canvas in the browser or to an image buffer in Node.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
// Browser: draw PDF417 onto a canvas element
import bwipjs from 'bwip-js';

export function renderPdf417(payload, canvas) {
  bwipjs.toCanvas(canvas, {
    bcid: 'pdf417',
    text: payload,
    scale: 2,
    height: 12,
    padding: 10,
  });
}

// Node: produce a PNG buffer for a scanner test
const png = await bwipjs.toBuffer({
  bcid: 'pdf417',
  text: payload,
  scale: 2,
  height: 12,
  padding: 10,
});

The bcid value selects the symbology. Use 'pdf417' for the printed-pass default. For matrix output, the corresponding identifiers in bwip-js are 'azteccode', 'datamatrix', and 'qrcode', but choose these only when the pass context calls for them (see the next section).

Step 4: Choose the symbology deliberately

IATA’s implementation-guide summary says version 7, effective June 1, 2018, extended printed-pass options at airline request to Aztec, Data Matrix, or QR. Those matrix formats were already used for electronic and mobile passes. The practical rule is simple: PDF417 for a printed pass unless a specific airline has asked for something else under the version you implement.

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)
Pass context Symbology Basis
Printed pass, no airline request PDF417 IATA default for printed passes
Printed pass, airline has requested an alternative Aztec, Data Matrix, or QR Permitted from version 7, effective June 1, 2018, at airline request
Electronic or mobile pass Aztec, Data Matrix, or QR Already used for these passes, per IATA’s summary

The table describes what the standard allows. Whether a particular airline or gate scanner accepts a given symbology is a separate question that IATA’s material does not answer, and that depends on the operator.

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 separately

Validation has two independent checks, and each catches a different failure. Run both before you call the output a passing test.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Check What it proves What it misses
Parser self-check That your payload splits back into the same fields at the same offsets, and that size fields match the sections they describe Whether a physical scanner can read the printed image
Optical scan of the rendered image That a PDF417-capable scanner or decoder can read the symbol you drew Whether the field layout is correct; a scannable symbol can still hold a malformed payload

For the parser check, reuse the same specification from Step 1 to slice the decoded string, compare every field with the original input, and recompute each size field from the characters it counts. For the optical check, print or display the PNG at real size and scan it with a PDF417-capable scanner, then decode and compare the result with the payload string you generated.

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.

Troubleshooting

  • Parser reports every field after one point as shifted. A mandatory width is off by one, or a value was not padded. Recheck the spec table against the standard, field by field.
  • Size field does not match the section. The size was computed before a conditional section was appended. Compute it last.
  • Scanner returns nothing or a partial read. The symbol is too small or the quiet zone is too narrow. Increase scale or padding and redraw at the size you will print.
  • Scanner reads the symbol but the parser fails. The symbology is working; the payload is wrong. Debug the payload, not the rendering.
  • Hex size fields look correct but parse wrongly. Check for lowercase digits or a missing leading zero; both should be consistent and two characters long.

What a passing test does not establish

A payload that parses cleanly and a symbol that scans are evidence about your code and your scanner. They are not evidence that a pass is valid for travel. Airline acceptance, security data, issuance rules, and operational checks sit outside the barcode format. Generate and use these artifacts only for development, scanner testing, and parser regression, and label them as synthetic in any environment where a person could mistake them for an issued pass.

If you are building a production issuer, the authority is the current IATA Resolution 792 and its implementation guide, together with each airline’s own requirements.

(Note for the reader: IATA’s standards page does not name a specific scanner model or product, and this guide does not recommend one. Any PDF417-capable scanner or decoder that can read the rendered symbol will serve for the optical check.)

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

Ignoring any part of this and treating a successful scan as proof of validity is the most common and most consequential mistake in this area.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.