LoRaWAN Payload Decoder
Decode a LoRaWAN data PHYPayload into MHDR, message type, DevAddr, frame control flags, frame counter, FOpts, FPort, FRMPayload and MIC. Optionally decrypt LoRaWAN 1.0.x FRMPayload bytes using the appropriate application or network session key.
—
| Field | Offset | Bytes | Decoded Value | Meaning |
|---|
—
What Is a LoRaWAN Payload Decoder?
A LoRaWAN Payload Decoder separates raw LoRaWAN PHYPayload bytes into the protocol fields contained in the radio frame. For ordinary data messages, these fields include MHDR, FHDR, DevAddr, FCtrl, FCnt, optional FOpts, FPort, FRMPayload and MIC.
The application payload carried inside FRMPayload is normally encrypted, so its bytes cannot be interpreted merely by looking at the hexadecimal radio packet.
LoRaWAN Data PHYPayload Layout
PHYPayload
+------+------------------------+------+
| MHDR | MACPayload | MIC |
+------+------------------------+------+
MACPayload
+------+-------+------------+
| FHDR | FPort | FRMPayload |
+------+-------+------------+
FHDR
+---------+-------+-------+-------+
| DevAddr | FCtrl | FCnt | FOpts |
+---------+-------+-------+-------+LoRaWAN MHDR
MHDR is the first byte of the PHYPayload. Bits 7 through 5 contain MType, bits 4 through 2 are reserved for RFU in the classic layout, and bits 1 through 0 identify the LoRaWAN major version.
MType = (MHDR >> 5) & 0x07
Major = MHDR & 0x03LoRaWAN Message Types
| MType | Meaning | Direction |
|---|---|---|
| 0 | Join-request | Uplink |
| 1 | Join-accept | Downlink |
| 2 | Unconfirmed Data Up | Uplink |
| 3 | Unconfirmed Data Down | Downlink |
| 4 | Confirmed Data Up | Uplink |
| 5 | Confirmed Data Down | Downlink |
| 6 | Rejoin-request | Uplink |
| 7 | Proprietary | Application-defined |
LoRaWAN DevAddr Byte Order
The DevAddr occupies four bytes in the FHDR. The octets are transmitted least significant byte first.
Frame bytes:
04 03 02 01
Decoded DevAddr:
0x01020304This byte-order conversion is one of the most common sources of confusion when manually reading LoRaWAN packets.
LoRaWAN Frame Control — FCtrl
The meaning of individual FCtrl flag bits depends partly on whether the frame is uplink or downlink. The low four bits always contain FOptsLen.
FOptsLen
= FCtrl & 0x0F
Valid range:
0 through 15 bytesThe decoder reports the raw FCtrl value and interprets the major flag bits using the selected or automatically detected frame direction.
LoRaWAN Frame Counter
Only the least significant 16 bits of the frame counter are transmitted in the ordinary FHDR field. A receiver normally reconstructs the full frame counter using session state.
FCnt32
= (Upper16 << 16)
| FCnt16The optional FCnt Upper 16 Bits field allows the calculator to reconstruct the 32-bit counter needed when decrypting a payload.
What Is FPort?
FPort identifies how FRMPayload should be interpreted cryptographically and logically.
FPort 1–255
→ Application payload
→ encrypted with AppSKey in LoRaWAN 1.0.x
FPort 0
→ MAC commands in FRMPayload
→ protected with a network session keyWhat Is FRMPayload?
FRMPayload is the variable-length encrypted portion following FPort. The raw radio bytes usually cannot be treated directly as ASCII, sensor values or JSON because LoRaWAN applies payload encryption.
After successful decryption, the resulting application bytes still require the device’s application-specific payload format to be known before fields such as temperature or humidity can be assigned meanings.
LoRaWAN 1.0.x FRMPayload Decryption
For LoRaWAN 1.0.x data frames, FRMPayload encryption is based on AES-128 and a sequence of counter blocks containing direction, DevAddr, frame counter and a block number.
A[i] contains:
0x01
00000000
Direction
DevAddr
FCnt32
0x00
Block CounterThe generated AES stream is XORed with the FRMPayload bytes. Because encryption and decryption both use XOR with the same generated stream, the transformation is symmetrical.
AppSKey vs NwkSKey
| FPort | LoRaWAN 1.0.x Key |
|---|---|
| 1–255 | AppSKey |
| 0 | NwkSKey |
LoRaWAN 1.1 separates network-session key responsibilities further, so this simple 1.0.x key selection should not be assumed to represent every LoRaWAN 1.1 security operation.
What Are FOpts?
FOpts is an optional area inside FHDR that can contain MAC commands. Its length is encoded in the low nibble of FCtrl and is limited to fifteen bytes in the classic frame format.
FCtrl = 0x03
FOptsLen
= 0x03 & 0x0F
= 3 bytesWhat Is the LoRaWAN MIC?
The Message Integrity Code is the final four bytes of the PHYPayload. It is used by LoRaWAN security processing to detect modification and authenticate the relevant frame context.
Example LoRaWAN Data Frame
40 04 03 02 01 00 01 00 01 48 69 AA BB CC DD
MHDR:
40
MType:
Unconfirmed Data Up
DevAddr bytes:
04 03 02 01
DevAddr:
0x01020304
FCtrl:
00
FCnt:
01 00
= 1
FPort:
01
FRMPayload:
48 69
MIC:
AA BB CC DD
The bytes 48 69 are intentionally shown as raw FRMPayload in this
example. Without a valid session key, the decoder does not claim they represent
the plaintext string “Hi”.
Why LoRaWAN Payload Bytes May Look Random
Application FRMPayload is encrypted, so encrypted bytes should normally look unrelated to the original sensor data. Seeing unreadable hexadecimal does not mean the radio packet is damaged.
To interpret encrypted application data, the correct AppSKey, DevAddr, direction and complete frame-counter value must correspond to the same LoRaWAN session.
LoRaWAN Payload Decoder vs Application Decoder
This page first decodes the LoRaWAN protocol envelope. That is separate from an application-specific payload decoder.
Stage 1:
Decode LoRaWAN PHYPayload
Stage 2:
Decrypt FRMPayload
Stage 3:
Interpret application bytes
Example application interpretation:
byte 0–1 → temperature
byte 2 → battery
byte 3–4 → pressureStage 3 requires the payload specification of the actual end device.
LoRaWAN Payload Decoder FAQs
What does this LoRaWAN decoder accept?
What is MHDR?
How do I decode DevAddr?
What is FOptsLen?
What is FCnt16?
Why does the decoder ask for upper FCnt bits?
Which key decrypts FPort 1?
Which key is used for FPort 0?
Does this decoder verify the MIC?
Can I decode LoRaWAN without an AppSKey?
Is DevAddr encrypted?
Is FPort encrypted?
Can the decrypted payload automatically tell me temperature?
Does this page fully implement LoRaWAN 1.1 security?
Inspect LoRaWAN PHYPayload Frames
Break raw LoRaWAN data packets into protocol fields and optionally decrypt LoRaWAN 1.0.x FRMPayload bytes when the correct session key and frame-counter context are available.