Home Explore Blog CI



nushell

commands/docs/decode_hex.md
a0b49246d8bb5402f513fe4530a8fd3d402e072160cf123900000003000003af
---
title: decode hex
categories: |
  formats
version: 0.104.0
formats: |
  Hex decode a value.
usage: |
  Hex decode a value.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `decode hex` for [formats](/commands/categories/formats.md)

<div class='command-title'>Hex decode a value.</div>

## Signature

```> decode hex {flags} ```


## Input/output types:

| input  | output |
| ------ | ------ |
| string | binary |
## Examples

Decode arbitrary binary data
```nu
> "09FD" | decode hex
Length: 2 (0x2) bytes | printable whitespace ascii_other non_ascii
00000000:   09 fd                                                _×

```

Lowercase Hex is also accepted
```nu
> "09fd" | decode hex
Length: 2 (0x2) bytes | printable whitespace ascii_other non_ascii
00000000:   09 fd                                                _×

```

Chunks
3ba4c86d (1st chunk of `commands/docs/decode_hex.md`)
Title: decode hex
Summary
The `decode hex` command, belonging to the 'formats' category in Nushell, is used to decode a hexadecimal string into its corresponding binary representation. This command accepts a string as input, which represents the hexadecimal encoded data, and outputs the decoded binary data. The input string can contain either uppercase or lowercase hexadecimal characters (0-9, A-F, a-f). The command processes the input string, converting each pair of hexadecimal characters into its equivalent byte value. The resulting bytes are then assembled into a binary data structure, which is the output of the command. This is useful for converting data from a human-readable hexadecimal format into a binary format that can be used by other commands or applications. An example demonstrates how the hexadecimal string '09FD' is decoded into binary data, resulting in a two-byte output. Lowercase hex like '09fd' also works.