---
title: format bits
categories: |
conversions
version: 0.104.0
conversions: |
Convert value to a string of binary data represented by 0 and 1.
usage: |
Convert value to a string of binary data represented by 0 and 1.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->
# `format bits` for [conversions](/commands/categories/conversions.md)
<div class='command-title'>Convert value to a string of binary data represented by 0 and 1.</div>
## Signature
```> format bits {flags} ...rest```
## Parameters
- `...rest`: For a data structure input, convert data at the given cell paths.
## Input/output types:
| input | output |
| -------- | ------ |
| binary | string |
| bool | string |
| duration | string |
| filesize | string |
| int | string |
| record | record |
| string | string |
| table | table |
## Examples
convert a binary value into a string, padded to 8 places with 0s
```nu
> 0x[1] | format bits
00000001
```
convert an int into a string, padded to 8 places with 0s
```nu
> 1 | format bits
00000001
```
convert a filesize value into a string, padded to 8 places with 0s
```nu
> 1b | format bits
00000001
```
convert a duration value into a string, padded to 8 places with 0s
```nu
> 1ns | format bits
00000001
```
convert a boolean value into a string, padded to 8 places with 0s
```nu
> true | format bits
00000001
```
convert a string into a raw binary string, padded with 0s to 8 places
```nu
> 'nushell.sh' | format bits
01101110 01110101 01110011 01101000 01100101 01101100 01101100 00101110 01110011 01101000
```