NVMe Command Capsule Utility

NVMe Command Decoder

Decode a 64-byte NVMe command capsule from hexadecimal bytes. Inspect command opcode, command identifier, namespace ID, metadata pointer, PRP or SGL data pointers, CDW10 through CDW15 and command-specific fields for common Admin and NVM commands.

✓ Admin Commands ✓ NVM Commands ✓ PRP / SGL ✓ Namespace ID ✓ Starting LBA ✓ CDW10–15
CMD
64-Byte NVMe Command
● Ready
Enter the 64-byte command capsule in memory/wire byte order. Spaces, commas, colons, hyphens and line breaks are accepted. NVMe DWORD fields are little-endian.
Opcode values can overlap between Admin and NVM command sets, so select the command set when context is known.
PSDT is encoded in Command DWORD 0.
NVMe command layout: a standard command capsule contains 16 DWORDs = 64 bytes. Command DWORD 0 includes OPC, FUSE, PSDT and CID. Namespace ID is in CDW1. Metadata pointer occupies CDW4–5, the data pointer occupies CDW6–9, and command-specific fields normally occupy CDW10–15.
NVMe Command Decode Result Decoded
Decoded Command
Opcode
Command Name
Command ID
Namespace ID
FUSE
PSDT
Metadata Pointer
Data Pointer 1
Data Pointer 2
Starting LBA
NLB / Count
Control
Feature / CNS / LID
CDW10
CDW11
CDW12–15
Command DWORDs
Command-Specific Decode
Field Breakdown

What Is an NVMe Command?

An NVMe command is a 64-byte command capsule submitted by host software to an NVMe Submission Queue. The controller reads the command, performs the requested operation and later posts a Completion Queue Entry.

Admin commands configure and manage the controller, while I/O command sets such as the NVM command set perform namespace data operations.

NVMe Command Size

Command size: 64 bytes DWORDs: 64 / 4 = 16 DWORDs CDW0 through CDW15

NVMe Command DWORD 0

Command DWORD 0 contains the opcode and several fields that apply to all standard commands.

CDW0: Bits 7:0 OPC Bits 9:8 FUSE Bits 15:14 PSDT Bits 31:16 CID

Other reserved or command-format-specific bits should be interpreted according to the applicable NVMe specification version.

NVMe Opcode

The Opcode field identifies the operation within the selected command set. The same numeric opcode can have different meanings in different command sets, so queue and command-set context matters.

Command Set Opcode Common Command
NVM0x00Flush
NVM0x01Write
NVM0x02Read
NVM0x08Write Zeroes
NVM0x09Dataset Management
Admin0x02Get Log Page
Admin0x06Identify
Admin0x09Set Features
Admin0x0AGet Features

Command Identifier

The Command Identifier, or CID, is selected by host software and copied into the associated completion. It allows the host to match a Completion Queue Entry with the submitted command.

CID = CDW0 bits 31:16

Namespace Identifier

CDW1 normally contains the Namespace Identifier. A namespace-specific NVM command such as Read or Write uses this field to select the target namespace.

CDW1: NSID Example: 0x00000001 = Namespace 1

NVMe Metadata Pointer

CDW4 and CDW5 form the 64-bit Metadata Pointer field when the applicable command uses a separate metadata buffer.

MPTR = CDW5 : CDW4

PRP1 and PRP2

When the command uses Physical Region Page pointers, CDW6 through CDW9 hold two 64-bit data pointers.

PRP1 = CDW7 : CDW6 PRP2 = CDW9 : CDW8

Depending on transfer length, PRP2 can reference either a second data page or a PRP List.

PSDT — PRP or SGL

The PRP or SGL Data Transfer field in CDW0 indicates how the data pointer area should be interpreted.

The decoder reports the raw PSDT value and can show the pointer region as PRPs or as a generic SGL descriptor view.

NVMe Read Command

The NVM Read command transfers logical blocks from a namespace into host memory. Its command-specific DWORDs include the starting logical block address, number of logical blocks and control information.

CDW10–11: Starting LBA CDW12 bits 15:0: NLB Actual logical blocks = NLB + 1

NVMe Write Command

Write uses a layout similar to Read, but data is transferred from host memory to the selected namespace.

OPC: 0x01 SLBA: CDW11 : CDW10 Logical Block Count: (CDW12 & 0xFFFF) + 1

Why NLB Is Zero-Based

For common NVM Read and Write commands, the Number of Logical Blocks field is zero-based.

NLB field = 0 means 1 logical block NLB field = 7 means 8 logical blocks

The decoder therefore reports both the raw field and the effective number of logical blocks.

Starting LBA

The Starting Logical Block Address is a 64-bit value formed from CDW10 and CDW11 for common NVM data commands.

SLBA = (CDW11 << 32) | CDW10

NVMe Flush

Flush requests that volatile write data associated with the namespace be made nonvolatile according to the controller's supported behavior.

Flush normally does not use an NLB or starting-LBA transfer range in the same way as Read and Write.

NVMe Write Zeroes

Write Zeroes requests that a range of logical blocks be logically written with zeroes without requiring a host data buffer containing the zero pattern.

The command includes Starting LBA and Number of Logical Blocks fields similar to other NVM range commands.

Dataset Management Command

Dataset Management allows software to communicate information about logical block ranges, such as deallocation hints. The command can reference one or more range descriptors in host memory.

The NR field is zero-based, so the effective number of ranges is normally the field value plus one.

NVMe Identify Command

Identify is an Admin command used to retrieve controller, namespace and other identification data structures. CDW10 contains the CNS selector and related fields.

Identify opcode: 0x06 CNS: CDW10 bits 7:0

Get Log Page Command

Get Log Page retrieves an NVMe log structure. CDW10 contains the Log Page Identifier along with transfer-length related fields, while later DWORDs can contain additional offset and selector information depending on the NVMe revision.

Admin Opcode: 0x02 LID: CDW10 bits 7:0

Get Features and Set Features

Feature commands use a Feature Identifier to select the controller or namespace feature being queried or changed.

FID = CDW10 bits 7:0

The meaning of CDW11 and later fields depends on the selected feature.

NVMe DWORD Endianness

NVMe multi-byte command fields are represented in little-endian byte order in memory. Therefore the first byte of a DWORD contains its least significant eight bits.

Bytes: 78 56 34 12 DWORD value: 0x12345678

The decoder handles this byte ordering automatically.

Command vs Completion

The 64-byte command submitted to a Submission Queue is different from the Completion Queue Entry returned by the controller. A completion contains status, queue information, command ID and command-specific result data rather than the original 64-byte command layout.

NVMe Command Decoder FAQs

How many bytes is an NVMe command?
A standard NVMe command capsule is 64 bytes, containing 16 32-bit command DWORDs.
Where is the NVMe opcode stored?
The command opcode occupies bits 7:0 of Command DWORD 0.
Where is the Command Identifier stored?
CID occupies bits 31:16 of Command DWORD 0.
Where is the Namespace ID?
The standard common command format stores NSID in Command DWORD 1.
How is the Starting LBA decoded?
For common NVM Read, Write and related commands, CDW10 contains the low 32 bits and CDW11 the high 32 bits.
Does NLB 0 mean zero blocks?
No. In common NVM data commands the NLB field is zero-based, so zero represents one logical block.
What are PRP1 and PRP2?
They are Physical Region Page pointers used to describe host memory containing or receiving command data.
What does PSDT mean?
It determines how the command's data pointer region is interpreted, including PRP or SGL-based transfer descriptions.
Can opcode 0x02 mean both Read and Get Log Page?
Yes. Opcode interpretation depends on the command set and queue context. In the NVM command set 0x02 is Read, while in the Admin command set 0x02 is Get Log Page.
Can this decoder replace an NVMe protocol analyzer?
No. It decodes a single command capsule. Complete analysis also requires queue context, controller state, negotiated features, namespace format, completion entries and the applicable NVMe specification revision.

Decode NVMe Submission Queue Commands

Inspect raw NVMe command capsules from driver traces, kernel logs, firmware, FPGA simulations and storage protocol captures with command-level decoding of common Admin and NVM fields.

Scroll to Top