Home Explore Blog CI



nushell

commands/docs/encode_hex.md
274888cc07f82b669eb158379e2336a28c7ca7d64cd97b6e0000000300000377
---
title: encode hex
categories: |
  formats
version: 0.104.0
formats: |
  Hex encode a binary value or a string.
usage: |
  Hex encode a binary value or a string.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

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

<div class='command-title'>Hex encode a binary value or a string.</div>

## Signature

```> encode hex {flags} ```

## Flags

 -  `--lower`: Encode to lowercase hex.


## Input/output types:

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

Encode a binary value
```nu
> 0x[C3 06] | encode hex
C306
```

Encode a string
```nu
> "hello" | encode hex
68656C6C6F
```

Output a Lowercase version of the encoding
```nu
> 0x[AD EF] | encode hex --lower
adef
```

Chunks
9115d936 (1st chunk of `commands/docs/encode_hex.md`)
Title: encode hex
Summary
This command encodes a binary value or a string into its hexadecimal representation. It accepts a binary value or a string as input and outputs a string. The `--lower` flag can be used to output the hexadecimal representation in lowercase.