# Bytes unpack integers

`bytes-unpack-integers` · version 1.0.0 · Other utilities · free, no key needed

Unpack raw hex bytes into exact signed or unsigned integer strings using an explicit endian layout.

**Use when you need to: binary bytes unpack integers little endian · decode little endian 32 bit unsigned integer hex bytes · unpack a hex byte string with Python struct format.**

## Decide before calling

Read the [versioned contract](/v1/tools/bytes-unpack-integers/versions/1.0.0) and the supported scope below. Reuse `bytes-unpack-integers@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `bytes-unpack-integers@1.0.0` for binary bytes unpack integers little endian. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- binary bytes unpack integers little endian
- decode little endian 32 bit unsigned integer hex bytes
- unpack a hex byte string with Python struct format
- read signed integers from network protocol bytes
- decode firmware fields with explicit endianness
- raw bytes to u16 i32 and u64 values
- interpret big endian integer fields

## Not supported

- bitwise AND masks
- floating-point fields
- native alignment or host byte order

## Behavior

- Returns decimal strings so all 64-bit values remain exact; standard_version is IEEE 754-2019; Python 3.12 struct.
- Layout is either named fields u8/i8/u16/i16/u32/i32/u64/i64 with le/be required above 8 bits, or Python struct subset < > ! = followed by x b B h H i I l L q Q and repeat counts; = is always little endian, never host order.
- The layout must consume exactly the supplied bytes; x consumes a zero-meaningless padding byte and returns no field.
- max_input_bytes bounds the UTF-8 byte length of JSON.stringify(input), including keys, punctuation, and every field. Field bounds apply together with this whole-input bound.
- max_hex_chars bounds the input hex string for unpacking and the output hex string for packing, allowing at most 256 raw bytes. max_layout_bytes bounds a string layout in UTF-8.

## Input

- `hex` (string, required): min length 2; max length 512; pattern `^[0-9A-Fa-f]+$`
- `layout` (string or array of string, required)

## Output

- `standard_version` (string, required)
- `byte_length` (integer, required): min 1; max 256
- `fields` (array of object, required): max items 64

## Limits

- max input bytes: 4096
- max hex chars: 512
- max layout bytes: 130
- max items: 64
- max output bytes: 8192

## Example

Request input:

```json
{
  "hex": "78563412",
  "layout": [
    "u32le"
  ]
}
```

Response:

```json
{
  "result": {
    "standard_version": "IEEE 754-2019; Python 3.12 struct",
    "byte_length": 4,
    "fields": [
      {
        "type": "u32le",
        "offset": 0,
        "value": "305419896"
      }
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "bytes-unpack-integers",
  "version": "1.0.0",
  "input": {
    "hex": "78563412",
    "layout": [
      "u32le"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/bytes-unpack-integers/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"hex":"78563412","layout":["u32le"]}'
```

The machine-readable contract is at [/v1/tools/bytes-unpack-integers/versions/1.0.0](/v1/tools/bytes-unpack-integers/versions/1.0.0).

### CLI

```sh
node cli.mjs run bytes-unpack-integers 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Bytes pack integers](/tools/bytes-pack-integers): Pack exact decimal integer strings into raw hex bytes with explicit widths, endianness, and range checks.
- [Base64url decode](/tools/base64url-decode): Decode base64url to UTF-8 text or lowercase hex and return the requested value.
- [Bytes format human](/tools/bytes-format-human): Format an exact byte count as both SI and IEC strings and return the rounding mode used.
- [Bytes parse human](/tools/bytes-parse-human): Parse an SI or IEC byte-size string and return an exact integer byte count using explicit rounding.
- [Float ieee754 convert](/tools/float-ieee754-convert): Convert binary16/32/64 decimal values and exact hex bits, returning fields, class, and the exact stored decimal.
- [Html to plain text](/tools/html-to-plain-text): Strip HTML and script/style text, decode supported references; collapse whitespace including inside pre elements.
