Chris Collins

Tools · aviation

Mode S and ADS-B decoder

Decode 1090 MHz Mode S and ADS-B messages field by field — CRC and parity, callsign, altitude, CPR positions with the maths shown, velocity, Gillham codes and Comm-B — from pasted hex, AVR or Beast frames, or live from your receiver over a WebSocket.

Added

How to use it

Paste one or more messages into Decode. Each line may be bare hex (8D4840D6202CC371C32CE0576098), AVR as dump1090 and readsb print it on port 30002 (*8D…;, or @ + a 12-digit MLAT time + the message), or a Beast binary frame written as hex (1a 33 + 6-byte MLAT time + signal byte + message, with any 1a byte doubled). A unix time may lead a line (1457996402 8D40…); it decides which of a pair of position frames is newer.

For every message you get:

  • The bit layout — each field as a coloured box with its bits and bit numbers (1–56 or 1–112), and a table with the raw value and what it means.

  • CRC / parity — the 24-bit CRC with generator polynomial 0x1FFF409. DF11/17/18 send the CRC itself (PI): dividing the whole message by the generator must leave zero, and if it doesn’t, the tool looks for the single flipped bit that explains the remainder (as dump1090 does) and offers the repaired message. Surveillance and Comm-B replies (DF0/4/5/16/20/21) overlay the CRC with the aircraft address (AP = CRC ⊕ address), so the remainder is the address; a receiver trusts it only if it has already heard that address in a checked message.

  • DF17/18 ADS-B by type code: identification (callsign, emitter category), airborne position (barometric altitude with the Q bit — 25 ft steps — or the Gillham 100 ft code; GNSS height for TC 20–22), surface position (movement code → ground speed, track), airborne velocity (subtype 1/2 ground speed from east–west and north–south components, 3/4 heading and IAS/TAS; ×4 for the supersonic subtypes; vertical rate and GNSS − baro difference), aircraft status (emergency and squawk), target state (selected altitude, QNH, selected heading, autopilot modes) and operational status (version, NACp, SIL).

  • Surveillance replies: DF0/4/16/20 altitude (13-bit AC field with the M bit for metres and Q bit), DF5/21 identity (squawk) from the Gillham bit order C1 A1 C2 A2 C4 A4 X B1 D1 B2 D2 B4 D4, DF11 all-call (capability, address).

  • Comm-B (DF20/21): BDS 1,0, BDS 2,0 (callsign), and BDS 4,0 / 5,0 / 6,0 inferred from their status bits and plausible ranges, as pyModeS does; when more than one register fits, all candidates are shown.

Positions (CPR)

Compact Position Reporting sends 17 bits of latitude and longitude within a zone. Paste an even (F = 0) and an odd (F = 1) frame from the same aircraft and the tool shows the global decode step by step: the latitude-zone index j = ⌊59·lateven − 60·latodd + ½⌋, both latitudes, the number of longitude zones NL(lat) = ⌊2π / acos(1 − (1 − cos(π/30)) / cos²(lat))⌋ (both must agree), the longitude index m and the final position from the newer frame. A single frame can be decoded locally against a reference within 180 NM (45 NM on the ground): enter your receiver’s latitude and longitude. Surface frames use 90° zones, so they always need the reference to pick the quadrant.

Many messages and live input

Many messages decodes a whole capture (paste it or open a text file, for example the output of nc <pi> 30002 > capture.txt) into a table per aircraft — callsign, squawk, altitude, speed, track, vertical rate, position, message count and signal — with counts by downlink format, CRC failures, repaired frames and unverified AP replies. Rows with squawk 7500, 7600 or 7700 are highlighted. Even/odd pairs are used only within 10 s of each other when the lines have times (any pair, in line order, when they don’t); later frames decode locally against the last fix.

With the gitwebsite app running on your computer, choose ⚡ gitwebsite app under Live, type the receiver’s host:port (e.g. piaware.local:30005 for Beast, or :30002 with raw AVR) and Connect: the app’s TCP relay opens the connection (add the target to its TCP allow-list in the Companion settings first). Not needed otherwise — the WebSocket relays below still work.

Live (WebSocket URL) connects to a relay that turns your receiver’s TCP output into a WebSocket — the format (AVR text or Beast binary) is detected and frames are reassembled across WebSocket messages. Two relays work:

  • The aviation relay from the Flight tracker help (section "Relay"): run python3 aviation-relay.py --beast <pi>:30005 --raw <pi>:30002 on your computer and connect to ws://127.0.0.1:8099/beast (the default here) or ws://127.0.0.1:8099/raw.

  • websockify: pip install websockify, then websockify 8765 <pi>:30005 (Beast) or websockify 8765 <pi>:30002 (AVR) and connect to ws://localhost:8765.

This page is served over https, and browsers block plain ws:// connections from an https page to anything but localhost/127.0.0.1 (mixed content). So run the relay on the computer you are browsing from, or put it behind TLS (wss://, for example with a Tailscale certificate or a reverse proxy), or open the page from http://127.0.0.1 (the gitwebsite app preview). Chrome may also ask for permission to reach devices on your local network.

Limits

  • Educational decoder, not a certified tool. Comm-B register inference is heuristic: a reply can fit several registers, and only BDS 1,0, 2,0, 4,0, 5,0 and 6,0 are tried (not the meteorological 4,4/4,5).

  • TCAS resolution advisories (TC 28 subtype 2), DF16 ACAS MV contents, DF19 military, DF24 Comm-D and operational-status capability/mode bits are shown as raw fields, not decoded further.

  • Only one-bit errors are repaired, and only in DF17/18. Mode A/C replies (2-byte Beast frames) are listed but not decoded, because their meaning depends on the interrogation.

  • No in-browser RTL-SDR (WebUSB). It is not implemented: a robust version needs a JavaScript driver for the RTL2832U and its R820T/R828D tuner, a 2 Msps PPM demodulator and preamble detector, and testing on real hardware across platforms (WinUSB via Zadig on Windows, detaching the dvb_usb_rtl28xxu kernel driver on Linux, Chrome only). Use dump1090-fa or readsb on a Raspberry Pi and the WebSocket relay instead.

  • The live view keeps everything in memory in this tab and shows a sample of the messages in the log.

Sources: Junzi Sun, The 1090 Megahertz Riddle: A Guide to Decoding Mode S and ADS-B Signals, 2nd edition, TU Delft OPEN Publishing, 2021 (mode-s.org/decode) — the worked examples for identification, position (even/odd pair and local decode), velocity and airspeed are its; and pyModeS (3.6), whose outputs for the other examples are the test reference values. RTCA DO-260B and ICAO Annex 10 Vol. IV define the formats.

Linking to an example

Settings have short parameters; the tab comes from the # part (#decode, #stream, #reference), for example /tools/mode-s/?msg=8D4840D6202CC371C32CE0576098. The reference position goes into a link only if you entered one; the WebSocket address and pasted captures in Many messages never do.

Parameter Meaning Example

msg

messages to decode, one per line (write a newline as %0A)

msg=8D485020994409940838175B284F

lat, lon

reference position for local and surface CPR decoding, in degrees

lat=52.258&lon=3.918

example

one of the presets below; other parameters override it

example=riddle-position

Presets:

  • riddle-ident — identification: KLM1023

  • riddle-position — even/odd pair → 52.2572°, 3.9194°, 38 000 ft

  • riddle-local — local decode against 52.258°, 3.918°

  • riddle-velocity — 159 kt, track 182.88°, −832 ft/min

  • riddle-airspeed — TAS 375 kt, heading 243.98°, −2304 ft/min

  • surface — surface position near Schiphol with a reference

  • crc-error — a corrupted message and its one-bit repair

  • emergency — aircraft status: squawk 6513

  • target-state — selected altitude, QNH, heading, autopilot modes

  • comm-b — DF20 BDS 2,0 callsign and DF21 BDS 5,0 track and turn

  • surveillance — DF4 altitude, DF0 ACAS, DF11 all-call

  • beast — a Beast binary frame with MLAT time and signal level

Runs entirely in your browser — network requests go only to the services named on this page.