Home Explore Blog CI



nushell

commands/docs/into_binary.md
ee09a98d7dd0cbec9e793e328b6bda0c9c3b06ca0ab2043a0000000300000a43
---
title: into binary
categories: |
  conversions
version: 0.104.0
conversions: |
  Convert value to a binary primitive.
usage: |
  Convert value to a binary primitive.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `into binary` for [conversions](/commands/categories/conversions.md)

<div class='command-title'>Convert value to a binary primitive.</div>

## Signature

```> into binary {flags} ...rest```

## Flags

 -  `--compact, -c`: output without padding zeros

## Parameters

 -  `...rest`: For a data structure input, convert data at the given cell paths.


## Input/output types:

| input    | output |
| -------- | ------ |
| binary   | binary |
| bool     | binary |
| datetime | binary |
| filesize | binary |
| int      | binary |
| number   | binary |
| record   | record |
| string   | binary |
| table    | table  |
## Examples

convert string to a nushell binary primitive
```nu
> 'This is a string that is exactly 52 characters long.' | into binary
Length: 52 (0x34) bytes | printable whitespace ascii_other non_ascii
00000000:   54 68 69 73  20 69 73 20  61 20 73 74  72 69 6e 67   This is a string
00000010:   20 74 68 61  74 20 69 73  20 65 78 61  63 74 6c 79    that is exactly
00000020:   20 35 32 20  63 68 61 72  61 63 74 65  72 73 20 6c    52 characters l
00000030:   6f 6e 67 2e                                          ong.

```

convert a number to a nushell binary primitive
```nu
> 1 | into binary
Length: 8 (0x8) bytes | printable whitespace ascii_other non_ascii
00000000:   01 00 00 00  00 00 00 00                             •0000000

```

convert a boolean to a nushell binary primitive
```nu
> true | into binary
Length: 8 (0x8) bytes | printable whitespace ascii_other non_ascii
00000000:   01 00 00 00  00 00 00 00                             •0000000

```

convert a filesize to a nushell binary primitive
```nu
> ls | where name == LICENSE | get size | into binary

```

convert a filepath to a nushell binary primitive
```nu
> ls | where name == LICENSE | get name | path expand | into binary

```

convert a float to a nushell binary primitive
```nu
> 1.234 | into binary
Length: 8 (0x8) bytes | printable whitespace ascii_other non_ascii
00000000:   58 39 b4 c8  76 be f3 3f                             X9××v××?

```

convert an int to a nushell binary primitive with compact enabled
```nu
> 10 | into binary --compact
Length: 1 (0x1) bytes | printable whitespace ascii_other non_ascii
00000000:   0a                                                   _

```

Chunks
1d6a76ed (1st chunk of `commands/docs/into_binary.md`)
Title: into binary
Summary
The `into binary` command in Nushell converts a value into a binary primitive. It supports various input types like strings, numbers, booleans, filesizes, and more. The `--compact` flag removes padding zeros from the output.