Home Explore Blog CI



nushell

commands/docs/decode.md
3db463b70bae48d2568a3e76c9530ea2f5d72d419e799e1b00000003000006d0
---
title: decode
categories: |
  strings
version: 0.104.0
strings: |
  Decode bytes into a string.
usage: |
  Decode bytes into a string.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

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

<div class='command-title'>Decode bytes into a string.</div>

## Signature

```> decode {flags} (encoding)```

## Parameters

 -  `encoding`: The text encoding to use.


## Input/output types:

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

Decode the output of an external command
```nu
> ^cat myfile.q | decode utf-8

```

Decode an UTF-16 string into nushell UTF-8 string
```nu
> 0x[00 53 00 6F 00 6D 00 65 00 20 00 44 00 61 00 74 00 61] | decode utf-16be
Some Data
```

## Notes
Multiple encodings are supported; here are a few:
big5, euc-jp, euc-kr, gbk, iso-8859-1, utf-16, cp1252, latin5

For a more complete list of encodings please refer to the encoding_rs
documentation link at https://docs.rs/encoding_rs/latest/encoding_rs/#statics

## Subcommands:

| name                                                     | description               | type     |
| -------------------------------------------------------- | ------------------------- | -------- |
| [`decode base32`](/commands/docs/decode_base32.md)       | Decode a Base32 value.    | built-in |
| [`decode base32hex`](/commands/docs/decode_base32hex.md) | Encode a base32hex value. | built-in |
| [`decode base64`](/commands/docs/decode_base64.md)       | Decode a Base64 value.    | built-in |
| [`decode hex`](/commands/docs/decode_hex.md)             | Hex decode a value.       | built-in |

Chunks
a32e9448 (1st chunk of `commands/docs/decode.md`)
Title: decode
Summary
The `decode` command in Nushell decodes bytes into a string using a specified text encoding. It supports various encodings like utf-8, utf-16, and others. It also has subcommands for decoding base32, base32hex, base64, and hex values.