Home Explore Blog CI



nushell

1st chunk of `commands/docs/encode_hex.md`
9115d9368fade85a4665b2cb280596031d06e2df51f975910000000100000377
---
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
```

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.