Skip to content

Latest commit

 

History

History
2774 lines (1921 loc) · 65.8 KB

File metadata and controls

2774 lines (1921 loc) · 65.8 KB

Data format

Operations for encoding and decoding data between common textual representations.

Operations are listed alphabetically.

Operation Subcommand Reference
AMF Decode amf-decode Action Message Format
AMF Encode amf-encode Action Message Format
Avro to JSON avro-to-json Apache Avro
Caret/M-decode caret-m-decode Caret notation
CBOR Decode cbor-decode CBOR
CBOR Encode cbor-encode CBOR
CSV to JSON csv-to-json Comma-separated values
Decode text decode-text Character encoding
Encode text encode-text Character encoding
Escape Smart Characters escape-smart-characters Punctuation
Escape Unicode Characters escape-unicode-characters Unicode
From Base from-base Radix
From Base32 from-base32 Base32
From Base45 from-base45 Base45
From Base58 from-base58 Base58
From Base62 from-base62 Base62
From Base64 from-base64 Base64
From Base85 from-base85 Ascii85
From Base92 from-base92 Base92
From BCD from-bcd Binary-coded decimal
From Bech32 from-bech32 Bech32
From Binary from-binary Binary
From Braille from-braille Braille
From COBS from-cobs Consistent Overhead Byte Stuffing
From Charcode from-charcode Character encoding
From Decimal from-decimal Decimal
From Float from-float IEEE 754
From Hex from-hex Hexadecimal
From Hex Content from-hex-content SNORT
From Hexdump from-hexdump Hex dump
From HTML Entity from-html-entity HTML character entities
From MessagePack from-messagepack MessagePack
From Modhex from-modhex ModHex
From Octal from-octal Octal
From Punycode from-punycode Punycode
From Quoted Printable from-quoted-printable Quoted-Printable
Hex to PEM hex-to-pem Privacy-Enhanced Mail
JSON to CSV json-to-csv Comma-separated values
JSON to YAML json-to-yaml YAML
MIME Decoding mime-decoding RFC 2047
Normalise Unicode normalise-unicode Unicode equivalence
Parse ASN.1 hex string parse-asn1-hex-string ASN.1
Parse TLV parse-tlv Type-length-value
PEM to Hex pem-to-hex Privacy-Enhanced Mail
Rison Decode rison-decode Rison
Rison Encode rison-encode Rison
Show Base64 offsets show-base64-offsets Base64 padding
Swap endianness swap-endianness Endianness
Text Encoding Brute Force text-encoding-brute-force Character encoding
Text-Integer Conversion text-integer-conversion Endianness
To Base to-base Radix
To Base32 to-base32 Base32
To Base45 to-base45 Base45
To Base58 to-base58 Base58
To Base62 to-base62 Base62
To Base64 to-base64 Base64
To Base85 to-base85 Ascii85
To Base92 to-base92 Base92
To BCD to-bcd Binary-coded decimal
To Bech32 to-bech32 Bech32
To Binary to-binary Binary
To Braille to-braille Braille
To COBS to-cobs Consistent Overhead Byte Stuffing
To Charcode to-charcode Character encoding
To Decimal to-decimal Decimal
To Float to-float IEEE 754
To Hex to-hex Hexadecimal
To Hex Content to-hex-content SNORT
To Hexdump to-hexdump Hex dump
To HTML Entity to-html-entity HTML character entities
To MessagePack to-messagepack MessagePack
To Modhex to-modhex ModHex
To Octal to-octal Octal
To Punycode to-punycode Punycode
To Quoted Printable to-quoted-printable Quoted-Printable
Unescape Unicode Characters unescape-unicode-characters Unicode
URL Decode url-decode Percent-encoding
URL Encode url-encode Percent-encoding
YAML to JSON yaml-to-json YAML

AMF Decode

Deserializes Action Message Format (AMF) binary data into JSON. AMF is a binary format used to serialize object graphs, e.g. between an Adobe Flash client and a remote service.

Backed by the github.com/elobuff/goamf library (CyberChef likewise wraps an AMF library); the JSON representation of decoded values follows that library.

Options

Flag Type Default Description
--format option AMF3 AMF version: AMF0 or AMF3.

Simple example

cchef from-hex --delimiter None -i 0200026869 | cchef amf-decode --format AMF0

Output:

"hi"

AMF Encode

Serializes JSON into Action Message Format (AMF) binary data. The output is raw bytes, so pipe through to-hex to view it.

Options

Flag Type Default Description
--format option AMF3 AMF version: AMF0 or AMF3.

Simple example

cchef amf-encode -i '{"a":1,"b":true}' | cchef to-hex --delimiter None

Output:

0a230103610362053ff000000000000003

Round trip (encode then decode)

printf '[1,2,3]' | cchef amf-encode | cchef amf-decode

Output:

[1,2,3]

Avro to JSON

Decodes an Apache Avro Object Container File (the binary format with an embedded schema, produced by Avro tooling) into JSON. The null and deflate block codecs are supported. With Force Valid JSON on (the default) the records are emitted as a single pretty-printed JSON value — an object for one record, an array for several; with it off, each record is emitted as its own compact JSON line (newline-delimited JSON). Input is raw bytes, so pipe binary in via from-hex or --in-file.

Options

Flag Type Default Description
--force-valid-json boolean true Emit one valid JSON value; off emits newline-delimited JSON, one record per line.

Simple example

A tiny container file (schema {"name": string}, one record) supplied as hex:

echo 4f626a0104166176726f2e736368656d6196017b2274797065223a227265636f7264\
222c226e616d65223a22736d616c6c222c226669656c6473223a5b7b226e616d65223a226e61\
6d65222c2274797065223a22737472696e67227d5d7d146176726f2e636f646563086e756c6c\
004e0247632e3702e5b75cdab9a62f1541020e0c6d796e616d654e0247632e3702e5b75cdab9\
a62f1541 | cchef from-hex | cchef avro-to-json

Output:

{
    "name": "myname"
}

Newline-delimited output

... | cchef from-hex | cchef avro-to-json --force-valid-json=false

Output:

{"name":"myname"}

Caret/M-decode

Decodes caret-notation and M-notation escapes as produced by tools such as cat -v: ^M becomes a carriage return (0x0d), ^I a tab, and M-^A becomes 0x81. Note that cat -v leaves ^_ unencoded even though it is a valid encoding of 0x1f.

Options

This operation takes no options.

Simple example

cchef caret-m-decode -i '^M^JHello M-^A' | cchef to-hex

Output:

0d 0a 48 65 6c 6c 6f 20 81

CBOR Decode

Decodes CBOR (Concise Binary Object Representation, RFC 8949) binary data into JSON. Byte strings render as objects keyed by index ({"0": 1, "1": 2}), maps keep their key order, date tags (0/1) become ISO strings, any other tag renders as {"tag": n, "contents": ...}, and a simple value with no assigned meaning renders as {"value": n}. Integers beyond JavaScript's safe range (2⁵³−1) and bignum tags decode to BigInts, which cannot be represented in JSON — those inputs are rejected. Input is raw bytes, so pipe binary in via from-hex or --in-file.

Fidelity. Several malformed inputs are refused here that take CyberChef down instead of producing an operation error: a truncated item, trailing bytes after a complete one, a stray break marker, and a simple value written in the two-byte form when a one-byte spelling exists.

Simple example

echo 'a3 61 61 01 61 62 02 61 63 03' | cchef from-hex | cchef cbor-decode

Output:

{
    "a": 1,
    "b": 2,
    "c": 3
}

Mixed array (a boolean and a double):

echo '82 f5 fb 40 09 21 fb 54 44 2d 18' | cchef from-hex | cchef cbor-decode

Output:

[
    true,
    3.141592653589793
]

CBOR Encode

Encodes JSON into canonical CBOR (RFC 8949). Canonical form uses the shortest encoding for every value — including half-precision floats — and orders map keys by their encoded bytes (length first), so the output is deterministic. Output is raw bytes; pipe through to-hex to view it.

Simple example

Map keys are emitted in canonical order regardless of input order:

echo -n '{"c":3,"a":1,"b":2}' | cchef cbor-encode | cchef to-hex

Output:

a3 61 61 01 61 62 02 61 63 03

Shortest float (1.5 encodes as a two-byte half-precision float):

echo -n '1.5' | cchef cbor-encode | cchef to-hex

Output:

f9 3e 00

CSV to JSON

Parses comma-separated values into JSON. Quoted fields, doubled quotes and embedded delimiters are handled per RFC 4180. Each character of the delimiter arguments is treated as its own delimiter, so the default row delimiter \r\n splits on either CR or LF.

Options

Flag Type Default Description
--cell-delimiters string , Characters that separate cells.
--row-delimiters string \r\n Characters that separate rows.
--format option Array of dictionaries Array of dictionaries keys each row by the header row; Array of arrays emits raw rows.

Array of dictionaries (the default — first row is the header):

printf 'name,age\r\nAda,36\r\nBob,40\r\n' | cchef csv-to-json

Output:

[
    {
        "name": "Ada",
        "age": "36"
    },
    {
        "name": "Bob",
        "age": "40"
    }
]

Array of arrays:

printf 'name,age\r\nAda,36\r\n' | cchef csv-to-json --format 'Array of arrays'

Output:

[
    [
        "name",
        "age"
    ],
    [
        "Ada",
        "36"
    ]
]

Decode text

Decodes bytes from the chosen character encoding into text. Input is raw bytes, so pipe binary in via from-hex or --in-file. Also listed under Language.

Charset coverage: All 152 charsets are supported — UTF-8/16/32, UTF-7, US-ASCII, the ISO-8859, Windows-125x, KOI8, OEM/DOS, EBCDIC, Mac and ISCII pages, Shift-JIS, EUC, GBK, Big5, Johab, GB18030 and the Taiwan legacy DBCS sets. decode-text --help lists them. The five ISO-2022 charsets are unsupported by cptable itself and error, exactly as upstream does.

Options

Flag Type Default Description
--encoding option UTF-8 (65001) The source character encoding.

Example (Windows-1251 Cyrillic bytes → text):

echo 'cf f0 e8 e2 e5 f2' | cchef from-hex | cchef decode-text --encoding 'Windows-1251 Cyrillic (1251)'

Output:

Привет

Encode text

Encodes text into the chosen character encoding, emitting raw bytes; pipe through to-hex to view them. Characters not representable in the target charset become a 0x00 byte (matching CyberChef). Also listed under Language; see Decode text for the charset coverage note.

Alternative to iconv for changing character encodings. The available encodings are CyberChef's set, named as CyberChef names them.

Options

Flag Type Default Description
--encoding option UTF-8 (65001) The target character encoding.

Example (text → Shift-JIS bytes):

printf '日本語' | cchef encode-text --encoding 'Japanese Shift-JIS (932)' | cchef to-hex

Output:

93 fa 96 7b 8c ea

Escape Smart Characters

Converts smart (typographic) Unicode characters — smart quotes, em/en dashes, ellipses, ©, ®, , arrows, guillemets, and non-ASCII spaces — into their plain ASCII equivalents. Characters with no ASCII mapping are handled per the option.

Options

Flag Type Default Description
--unmappable-characters option Include What to do with non-ASCII characters that have no mapping: Include (keep them), Remove, or Replace with '.'.

Simple example

cchef escape-smart-characters -i '“Hello” — world…'

Output:

"Hello" -- world...

Removing unmappable characters

cchef escape-smart-characters --unmappable-characters Remove -i 'warning: ☣ hazard'

Output:

warning:  hazard

Escape Unicode Characters

Converts characters to their unicode-escaped notation. By default only non-printable and non-ASCII characters are escaped and printable ASCII is left unchanged; pass --encode-all-chars to escape everything. Non-BMP characters are escaped as UTF-16 surrogate pairs.

Options

Flag Type Default Description
--prefix option \u Escape prefix: \u, %u, or U+.
--encode-all-chars boolean false Escape every character, not just non-printable/non-ASCII ones.
--padding number 4 Minimum hex digits per escape (zero-padded; never truncates).
--uppercase-hex boolean true Use upper-case hex digits.

Simple example

cchef escape-unicode-characters -i 'Héllo'

Output:

H\u00E9llo

Encode everything with the U+ prefix

cchef escape-unicode-characters --prefix 'U+' --encode-all-chars -i 'Hi'

Output:

U+0048U+0069

From Base

Converts a number from a given numerical base (radix 2–36) to decimal. Only integer values are supported.

Options

Flag Type Default Description
--radix number 36 The base of the input number (2–36).

Simple example

cchef from-base --radix 16 -i ff

Output:

255

From Base32

Decodes a Base32 string back into its raw byte value.

Options

Flag Type Default Description
--alphabet string A-Z2-7= The Base32 alphabet.
--remove-non-alphabet-chars bool true Strip characters outside the alphabet before decoding.

Simple example

cchef from-base32 -i 'JBSWY3DP'

Output:

Hello

From Base45

Decodes a Base45 string back into its raw byte value (RFC 9285).

Options

Flag Type Default Description
--alphabet string 0-9A-Z $%*+\-./: The Base45 alphabet.
--remove-non-alphabet-chars bool true Strip characters outside the alphabet before decoding.

Simple example

cchef from-base45 -i 'QED8WEX0'

Output:

ietf!

From Base58

Decodes a Base58 string back into its raw byte value.

Options

Flag Type Default Description
--alphabet string Bitcoin alphabet The 58-character alphabet (Bitcoin by default; Ripple also common).
--remove-non-alphabet-chars bool true Skip characters outside the alphabet.

Simple example

cchef from-base58 -i 'StV1DL6CwTryKyV'

Output:

hello world

From Base62

Decodes a Base62 string back into its raw byte value.

Options

Flag Type Default Description
--alphabet string 0-9A-Za-z The Base62 alphabet.

Simple example

cchef from-base62 -i '1wJfrzvdbtXUOlUjUf'

Output:

Hello, World!

From Base64

Decodes data from an ASCII Base64 string back into its raw form.

Alternative to base64 -d. cchef's --remove-non-alphabet (on by default) tolerates whitespace and stray characters that base64 -d rejects.

Options

Flag Type Default Description
--alphabet string A-Za-z0-9+/= The Base64 alphabet.
--remove-non-alphabet-chars bool true Strip characters outside the alphabet (e.g. newlines) before decoding.
--strict-mode bool false Reserved for stricter validation.

Simple example

cchef from-base64 -i 'SGVsbG8sIFdvcmxkIQ=='

Output:

Hello, World!

From Base85

Decodes a Base85 (Ascii85) string back into its raw byte value.

Options

Flag Type Default Description
--alphabet string !-u The 85-character alphabet (Standard, Z85, or IPv6).
--remove-non-alphabet-chars bool true Skip characters outside the alphabet.
--all-zero-group-char string z Character representing an all-zero 4-byte group.

Simple example

cchef from-base85 -i '9jqo^'

Output:

Man

(Delimited input like <~9jqo^~> is also accepted.)

From Base92

Decodes a Base92 string back into its raw byte value. Takes no options.

Simple example

cchef from-base92 -i "G'_DW[B"

Output:

ietf!

From BCD

Decodes a Binary-Coded Decimal value into a decimal number. Each decimal digit is represented by a fixed group of bits under the chosen encoding scheme; a trailing nibble may carry the sign.

Options

Flag Type Default Description
--scheme option 8 4 2 1 Encoding scheme: 8 4 2 1, 7 4 2 1, 4 2 2 1, 2 4 2 1, 8 4 -2 -1, Excess-3, IBM 8 4 2 1.
--packed boolean true Two digits per byte (packed) vs one digit per byte (unpacked).
--signed boolean false Treat the final nibble as a sign (D/B = negative).
--input-format option Nibbles Input representation: Nibbles, Bytes, or Raw.

Simple example

cchef from-bcd -i '0001 0010 0011 0100'

Output:

1234

Packed, signed bytes (negative value)

cchef from-bcd --packed --signed --input-format Bytes \
    -i '00000001 00100011 01000101 01100111 10001001 00001101'

Output:

-1234567890

From Bech32

Decodes a Bech32 or Bech32m string (BIP-0173 / BIP-0350) back to its data, verifying the checksum. Auto-detect tries Bech32 first, then Bech32m. For Bitcoin SegWit HRPs (bc, tb, ltc, …) the leading witness-version word is handled specially; other inputs decode generically. The output format selects how the decoded bytes are rendered.

Options

Flag Type Default Description
--encoding option Auto-detect Auto-detect, Bech32, or Bech32m.
--output-format option Raw Raw, Hex, Bitcoin scriptPubKey, HRP: Hex, or JSON.

Simple example

cchef from-bech32 --encoding Bech32 --output-format Raw -i 'bc1fpjkcmr0gzsgcg'

Output:

Hello

Bitcoin scriptPubKey and JSON output

cchef from-bech32 --output-format 'Bitcoin scriptPubKey' \
    -i 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4'

Output:

0014751e76e8199196d454941c45d1b3a323f1433bd6
cchef from-bech32 --output-format JSON -i 'bc1fpjkcmr0gzsgcg'

Output:

{
  "hrp": "bc",
  "encoding": "Bech32",
  "data": "48656c6c6f"
}

From Binary

Converts a binary string back into its raw form.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Comma, Semi-colon, Colon, Line feed, CRLF, None.
--byte-length number 8 Number of bits per byte.

Simple example

cchef from-binary -i '01001000 01101001'

Output:

Hi

From Braille

Converts six-dot braille symbols (U+2800-U+283F) back to text using CyberChef's braille lookup. Characters that are not braille symbols are passed through unchanged. Note that the lookup only stores upper-case letters, so decoded text is upper-case.

This operation takes no options.

Simple example

cchef from-braille -i '⠓⠑⠇⠇⠕'

Output:

HELLO

From COBS

Reverses To COBS, putting the zero bytes back. Takes no options.

Data containing a zero byte is not COBS and is refused.

Simple example

cchef from-hex -i "01 03 11 22 02 33" | cchef from-cobs | cchef to-hex

Output:

00 11 22 00 33

From Charcode

Converts unicode character codes (in the given base) back into text.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Comma, Semi-colon, Colon, Line feed, CRLF.
--base number 16 Radix of the character codes (2–36).

Simple example

cchef from-charcode -i '41 42'

Output:

AB

From Decimal

Converts a delimited list of decimal byte values back into raw bytes.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Comma, Semi-colon, Colon, Line feed, CRLF.
--support-signed-values bool false Interpret negative values as their unsigned byte equivalents.

Simple example

cchef from-decimal -i '72 73'

Output:

HI

From Float

Converts decimal numbers into their IEEE 754 floating-point byte representation.

Options

Flag Type Default Description
--endianness option Big Endian Big Endian or Little Endian.
--size option Float (4 bytes) Float (4 bytes) (single precision) or Double (8 bytes) (double precision).
--delimiter option Space Separator between numbers: Space, Comma, Semi-colon, Colon, Line feed, CRLF.

Simple example

cchef from-float -i '0.5 0.5' | cchef to-hex --delimiter None

Output:

3f0000003f000000

Little-endian double precision

cchef from-float --endianness 'Little Endian' --size 'Double (8 bytes)' -i '0.5' \
    | cchef to-hex --delimiter None

Output:

000000000000e03f

From Hex

Converts a hexadecimal byte string back into its raw value.

Options

Flag Type Default Description
--delimiter option Auto Auto splits on any non-hex character. Other values match to-hex.

Simple example

cchef from-hex -i '48 65 6c 6c 6f'

Output:

Hello

Auto delimiter (mixed separators)

cchef from-hex --delimiter 'Auto' -i '48:65,6c-6c6f'

Output:

Hello

From Hex Content

Translates SNORT hex-content notation back to raw bytes: each |<hex>| block is decoded (spaces inside the block are ignored) and everything outside the blocks is passed through unchanged. A |...| block whose contents are not hexadecimal is left as-is.

Options

This operation takes no options.

Simple example

cchef from-hex-content -i 'foo|3d|bar'

Output:

foo=bar

Embedded bytes (a CRLF inside a request line)

cchef from-hex-content -i 'GET /|0d 0a|Host'

Output:

GET /
Host

From Hexdump

Attempts to convert a hexdump back into raw data. Many tool formats are supported (xxd, Wireshark, 010 Editor, hexdump -C, …); the offset and ASCII preview columns are ignored and only the hex bytes are decoded. Verify the result is correct before relying on it.

Options

This operation takes no options.

Simple example

cchef from-hexdump -i '00000000  48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21           |Hello, World!|'

Output:

Hello, World!

From HTML Entity

Converts HTML character entities back into raw characters. Named entities (&amp;), decimal entities (&#233;), and hexadecimal entities (&#xe9;) are all decoded; unrecognized entities are left untouched.

Options

This operation takes no options.

Simple example

cchef from-html-entity -i '&amp; &lt; &#233; &#x20ac;'

Output:

& < é €

From MessagePack

Converts MessagePack encoded data to JSON. MessagePack is a compact binary serialization format for the same data model as JSON. Byte strings render as Node Buffer objects ({"type": "Buffer", "data": [...]}), map keys are coerced to strings, timestamp extensions become ISO date strings, and integers beyond JavaScript's safe range (2⁵³) lose precision — matching CyberChef's notepack.io backing library. Input is raw bytes, so pipe binary in via from-hex or --in-file.

Simple example

echo '83 a1 61 01 a1 62 02 a1 63 03' | cchef from-hex | cchef from-messagepack

Output:

{
    "a": 1,
    "b": 2,
    "c": 3
}

Mixed array (a boolean and a float):

echo '92 c3 cb 40 09 21 f9 f0 1b 86 6e' | cchef from-hex | cchef from-messagepack

Output:

[
    true,
    3.14159
]

From Modhex

Converts a modhex byte string back into its raw value. Modhex substitutes the 16 hex nibbles with the consonant alphabet cbdefghijklnrtuv (used by YubiKey to be keyboard-layout independent).

Options

Flag Type Default Description
--delimiter option Auto Auto splits on any non-modhex character. Also: Space, Percent, Comma, Semi-colon, Colon, Line feed, CRLF, None.

Simple example

cchef from-modhex -i 'hb hd hg id ik ie if ii ik if hj'

Output:

aberystwyth

Auto delimiter (mixed case, mixed separators)

cchef from-modhex --delimiter Auto -i 'uhKGkb,UHkgkB,UGltlk,ugltkc'

Output:

救救孩子

From Octal

Converts an octal byte string back into its raw value.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Comma, Semi-colon, Colon, Line feed, CRLF.

Simple example

cchef from-octal -i '110 145 154 154 157'

Output:

Hello

From Punycode

Decodes Punycode (RFC 3492) ASCII back into Unicode. By default the whole input is treated as a single Punycode string. With the Internationalised domain name option, only xn-- labels of a domain name (or the domain of an email address) are decoded, the rest passing through unchanged.

Options

Flag Type Default Description
--internationalised-domain-name boolean false Decode a domain name (only xn-- labels) rather than a raw Punycode string.

Simple example

cchef from-punycode -i 'mnchen-3ya'

Output:

münchen

Complex example (decode an internationalised domain name):

cchef from-punycode --internationalised-domain-name -i 'xn--mnchen-3ya.de'

Output:

münchen.de

From Quoted Printable

Decodes Quoted-Printable text back into raw bytes: =XX escapes become their byte value, soft line breaks (= at end of line) are removed, and everything else passes through.

Options

This operation takes no options.

Simple example

cchef from-quoted-printable -i 'a=3Db =26 caf=C3=A9'

Output:

a=b & café

Hex to PEM

Converts a hexadecimal DER string into PEM format: the bytes are base64-encoded, wrapped at 64 characters, and armored with the given header. The output uses CRLF line endings, matching CyberChef.

Options

Flag Type Default Description
--header-string string CERTIFICATE The type placed in the -----BEGIN <type>----- / -----END <type>----- armor.

Simple example

cchef hex-to-pem -i '3003010100'

Output:

-----BEGIN CERTIFICATE-----
MAMBAQA=
-----END CERTIFICATE-----

Custom header

cchef hex-to-pem --header-string 'PUBLIC KEY' -i '3059301306072a8648ce3d020106082a8648ce3d0301070342000414b41c05bcc3c1ea3a69fe24de4d2029630d58e6559fcfbd847dabbf80ca29867b135cfae0b06d3e707580ccfef870cac92af6a330f7ff8e9d21b40c5d464aa7'

Output:

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFLQcBbzDweo6af4k3k0gKWMNWOZV
n8+9hH2rv4DKKYZ7E1z64LBtPnB1gMz++HDKySr2ozD3/46dIbQMXUZKpw==
-----END PUBLIC KEY-----

JSON to CSV

Converts JSON to CSV per RFC 4180. An array of objects becomes a header row plus one row per object; an array of arrays is written row for row. Nested objects and arrays are flattened into dotted column names (e.g. b.c, b.0), and cells containing a delimiter, quote or newline are quoted.

Options

Flag Type Default Description
--cell-delimiter string , Character(s) between cells.
--row-delimiter string \r\n Character(s) between rows.

Array of objects:

cchef json-to-csv -i '{"a":1,"b":"2","c":3}'

Output:

a,b,c
1,2,3

Nested JSON (flattened to dotted columns):

cchef json-to-csv -i '{"a":1,"b":{"c":2,"d":3}}'

Output:

a,b.c,b.d
1,2,3

JSON to YAML

Formats a JSON value as YAML. Object key order is preserved, numbers keep JSON's formatting (no scientific notation for plain integers), and nested collections use a 2-space block style.

Fidelity note: CyberChef writes YAML with the JavaScript js-yaml library, whose formatting is particular enough that no Go YAML library reproduces it, so cchef writes its own: a scalar needing quotes takes single ones, a word that would read back as a boolean or a number (yes, 123, ~) is quoted to stop it, a line past 80 columns is folded into a >- block, a character outside the basic plane is written as itself, and an exponent whose mantissa has no decimal point is spelled 1.e+100. Output is byte-identical to CyberChef's.

Simple example

cchef json-to-yaml -i '{"name":"cchef","tags":["cli","yaml"],"active":true}'

Output:

name: cchef
tags:
  - cli
  - yaml
active: true

MIME Decoding

Decodes RFC 2047 MIME encoded-word header extensions (=?charset?encoding?text?=) so non-ASCII text in message headers is rendered as Unicode. Both the B (Base64) and Q (Quoted-Printable-like) encodings are supported, whitespace between adjacent encoded words is dropped per the RFC, and the UTF-8, US-ASCII and ISO-8859-* charsets are handled. ISO-8859-12 was never standardized and has no mapping, so it is refused, as upstream refuses it.

Simple example

cchef mime-decoding -i 'Subject: =?UTF-8?B?Y2Fmw6k=?='

Output:

Subject: café

Multiple encoded words (adjacent-word whitespace is dropped):

cchef mime-decoding -i '=?utf-8?q?=C3=89ric?= <eric@example.org>'

Output:

Éric <eric@example.org>

Normalise Unicode

Transforms text to one of the four Unicode Normalization Forms. Canonical forms (NFC/NFD) preserve the visible text; compatibility forms (NFKC/NFKD) additionally fold ligatures, Roman numerals, fractions and similar into their plain equivalents.

Options

Flag Type Default Description
--normal-form option NFD One of: NFD, NFC, NFKD, NFKC.

Simple example (a ligature compatibility-decomposes under NFKD):

cchef normalise-unicode --normal-form NFKD -i ''

Output:

fi

Compatibility composition (Roman numerals fold to ASCII letters under NFKC):

cchef normalise-unicode --normal-form NFKC -i 'ⅠⅡ'

Output:

III

Parse ASN.1 hex string

Parses arbitrary ASN.1 data — supplied as a hex string — and prints the decoded BER/DER structure as an indented tree. Use To Hex first if your data is binary. Whitespace in the input is ignored and hex is case-insensitive. Recognized object identifiers are shown by name (e.g. sha256, commonName) alongside their dotted form; unknown OIDs show the dotted form only. Long primitive values are abbreviated in the middle, with the truncation length configurable.

This operation is also listed under Public Key.

Options

Flag Type Default Description
--starting-index number 0 Offset, in hex characters, at which to start parsing.
--truncate-octet-strings number 32 Values longer than this many bytes are shown as their first and last N hex characters, where N is this value.

Simple example

Decoding an AlgorithmIdentifier (SHA-256):

cchef parse-asn1-hex-string -i '300d06096086480165030402010500'

Output:

SEQUENCE
  ObjectIdentifier sha256 (2 16 840 1 101 3 4 2 1)
  NULL

Complex example

An X.509 subjectAltName extension, whose [2] (dNSName) entries are decoded as text, with octet strings truncated to their first and last 8 hex characters:

cchef parse-asn1-hex-string -i '30100603551d11040930078205612e636f6d' \
    --truncate-octet-strings 8

Output:

SEQUENCE
  ObjectIdentifier subjectAltName (2 5 29 17)
  OCTETSTRING, encapsulates
    SEQUENCE
      [2] a.com

Fidelity note: The dump follows CyberChef's jsrsasign-based output, including its quirks — e.g. ENUMERATED values are rendered with a base-10 read of the hex value, and invalid UTF-8 in a string type prints as null. One deliberate divergence: where jsrsasign throws a JavaScript error on a BMPString shorter than a single UTF-16 code unit, cchef decodes the complete code units it has.


Parse TLV

Converts a Type-Length-Value (TLV) encoded string into a JSON array of {key, length, value} records. Each record's key and value are emitted as byte arrays. Set the type/key size to 0 to parse plain Length-Value (LV) data, in which case the key field is omitted.

With Use BER enabled the length is read using BER/DER rules: a length byte with its high bit set introduces a big-endian long form whose low bits give the number of following length bytes, so the fixed length size is ignored.

Options

Flag Type Default Description
--typekey-size number 1 Bytes of type/key preceding each length. 0 parses Length-Value data with no key.
--length-size number 1 Bytes used for each length field (ignored when --use-ber is set).
--use-ber boolean false Decode lengths using BER/DER long-form rules.

The type/key and length sizes may not both be 0.

Simple example

Key-Length-Value data with one-byte keys and lengths:

printf '\x04\x05House\x05\x04room\x42\x04door' | cchef parse-tlv --typekey-size 1 --length-size 1

Output:

[{"key":[4],"length":5,"value":[72,111,117,115,101]},{"key":[5],"length":4,"value":[114,111,111,109]},{"key":[66],"length":4,"value":[100,111,111,114]}]

BER long-form lengths

The second record encodes its length 5 in BER long form (0x81 0x05); the fixed length size is ignored:

printf '\x01\x05Hello\x02\x81\x05World' | cchef parse-tlv --typekey-size 1 --length-size 1 --use-ber

Output:

[{"key":[1],"length":5,"value":[72,101,108,108,111]},{"key":[2],"length":5,"value":[87,111,114,108,100]}]

PEM to Hex

Converts PEM format into a hexadecimal DER string. Every -----BEGIN <type>----- / -----END <type>----- block is decoded and hex-encoded; multiple blocks are concatenated with newlines. An error is raised if a block's footer is missing.

Options

This operation takes no options.

Simple example

cchef pem-to-hex -i '-----BEGIN PUBLIC KEY-----

Output:

MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFLQcBbzDweo6af4k3k0gKWMNWOZV
n8+9hH2rv4DKKYZ7E1z64LBtPnB1gMz++HDKySr2ozD3/46dIbQMXUZKpw==
-----END PUBLIC KEY-----'
3059301306072a8648ce3d020106082a8648ce3d0301070342000414b41c05bcc3c1ea3a69fe24de4d2029630d58e6559fcfbd847dabbf80ca29867b135cfae0b06d3e707580ccfef870cac92af6a330f7ff8e9d21b40c5d464aa7

Rison Decode

Parses a Rison string into JSON. Rison is a compact, URI-friendly variant of JSON. The output is pretty-printed JSON.

Options

Flag Type Default Description
--decode-option option Decode Decode parses a full Rison value; Decode Object wraps the input in (…) first (object Rison, "o-rison"); Decode Array wraps it in !(…) (array Rison, "a-rison").

Simple example

cchef rison-decode -i '(name:cchef,n:42,tags:!(a,b))'

Output:

{
    "name": "cchef",
    "n": 42,
    "tags": [
        "a",
        "b"
    ]
}

Complex example

Object Rison omits the outer parentheses, so use Decode Object:

cchef rison-decode --decode-option 'Decode Object' -i 'a:1,b:2'

Output:

{
    "a": 1,
    "b": 2
}

Rison Encode

Serializes JSON into Rison. Object keys are sorted, matching the reference implementation.

Options

Flag Type Default Description
--encode-option option Encode Encode produces a full Rison value; Encode Object drops the outer parentheses (object Rison); Encode Array drops the outer !(…) (array Rison); Encode URI additionally applies Rison's tolerant URI encoding.

Simple example

cchef rison-encode -i '{"name":"cchef","tags":["a","b"],"n":42}'

Output:

(n:42,name:cchef,tags:!(a,b))

Complex example

Encode URI percent-encodes for use in a URL (note Rison keeps , : @ $ / readable where it can, and encodes spaces as +):

cchef rison-encode --encode-option 'Encode URI' -i '{"q":"a b,c"}'

Output:

(q:'a+b,c')

Fidelity note: The output follows the rison library's behavior — including its quirks, such as encoding object keys in sorted order and replacing only the first occurrence of each escaped sequence in Encode URI. Object keys are sorted by UTF-8 byte order, which matches the reference implementation's UTF-16 sort for all but astral-plane characters.

Show Base64 offsets

When a string sits inside a larger block that is Base64-encoded as a whole, the string encodes to one of three different Base64 forms depending on its byte offset (0, 1, or 2) within the block. This shows all three so each candidate encoding can be searched for.

Options

Flag Type Default Description
--alphabet string A-Za-z0-9+/= The Base64 alphabet to use.
--show-variable-chars-and-padding boolean true Annotate the output (as HTML, matching CyberChef) to mark which characters are variable vs. padding. Set false for just the three plain offset strings.
--input-format option Raw Raw treats the input as bytes; Base64 decodes it first.

Simple example (plain offsets)

cchef show-base64-offsets --show-variable-chars-and-padding=false -i 'SecretData'

Output:

U2VjcmV0RGF0Y
NlY3JldERhdG
TZWNyZXREYXRh

Annotated output

With the default --show-variable-chars-and-padding, the output is the same HTML CyberChef produces (<span> highlights and tooltips), suitable for rendering in a browser rather than reading in a terminal.

Swap endianness

Reverses the byte order within fixed-length words.

Options

Flag Type Default Description
--data-format option Hex Hex or Raw. Hex output is space-delimited.
--word-length-bytes number 4 Bytes per word.
--pad-incomplete-words bool true Zero-pad a trailing word shorter than the word length.

Simple example

cchef swap-endianness --data-format Hex --word-length-bytes 4 -i 0a0b0c0d

Output:

0d 0c 0b 0a

Raw data

cchef swap-endianness --data-format Raw --word-length-bytes 2 -i ABCD

Output:

BADC

Text Encoding Brute Force

Enumerates every supported character encoding for the input, so you can quickly spot the correct one. The output is a JSON object mapping each of the 152 charset names to the result (or Could not decode. for the five ISO-2022 charsets cptable does not support).

Options

Flag Type Default Description
--mode option Encode Decode treats the input bytes as each charset and decodes to text; Encode encodes the input text in each charset (rendered as UTF-8/Latin-1).

Example (decode Windows-1251 Cyrillic bytes — the Windows-1251 row reads correctly):

printf '\xcf\xf0\xe8\xe2\xe5\xf2' | cchef text-encoding-brute-force --mode Decode

Output:

{
    ...
    "Windows-1251 Cyrillic (1251)": "Привет",
    "Windows-1252 Latin (1252)": "Ïðèâåò",
    "KOI8-R Russian Cyrillic (20866)": "оПХБЕР",
    ...
    "ISO 2022 Korean (50225)": "Could not decode.",
    ...
}

(Output elided — the real object has one entry per charset.)

Text-Integer Conversion

Converts between text and a large integer, treating the text as a big-endian sequence of character codes (e.g. ABC is 0x414243 is 4276803). The input format is auto-detected: 0x… is hexadecimal, plain digits are decimal, and anything else (optionally wrapped in single or double quotes) is text. Text may only contain ASCII/Latin-1 characters (code point < 256); multi-byte Unicode characters produce an error.

Options

Flag Type Default Description
--output-format option String Output as String, Decimal, or Hexadecimal.

Simple example

cchef text-integer-conversion --output-format Hexadecimal -i '"CyberChef"'

Output:

0x437962657243686566

Integer back to text

cchef text-integer-conversion --output-format String -i '0x48656C6C6F'

Output:

Hello

To Base

Converts a decimal number to a different numerical base (radix 2–36).

Options

Flag Type Default Description
--radix number 36 The target base (2–36).

Simple example

cchef to-base --radix 16 -i 255

Output:

ff

Binary

cchef to-base --radix 2 -i 255

Output:

11111111

To Base32

Base32 encodes arbitrary byte data using a restricted symbol set (usually A-Z and 2-7).

Alternative to base32, with the same one-line, configurable-alphabet differences as To Base64.

Options

Flag Type Default Description
--alphabet string A-Z2-7= The Base32 alphabet. Use 0-9A-V= for Hex Extended.

Simple example

cchef to-base32 -i 'Hello'

Output:

JBSWY3DP

To Base45

Base45 encodes arbitrary byte data, used notably in QR codes (RFC 9285).

Options

Flag Type Default Description
--alphabet string 0-9A-Z $%*+\-./: The Base45 alphabet.

Simple example

cchef to-base45 -i 'Hello!!'

Output:

%69 VD92EX0

To Base58

Base58 encodes arbitrary byte data using an alphabet that omits easily-confused characters. Commonly used for cryptocurrency addresses.

Options

Flag Type Default Description
--alphabet string Bitcoin alphabet The 58-character alphabet.

Simple example

cchef to-base58 -i 'hello world'

Output:

StV1DL6CwTryKyV

Ripple alphabet

cchef to-base58 --alphabet 'rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz' -i 'hello world'

Output:

StVrDLaUATiyKyV

To Base62

Base62 encodes arbitrary byte data using alphanumeric characters by treating the data as a large integer.

Options

Flag Type Default Description
--alphabet string 0-9A-Za-z The Base62 alphabet.

Simple example

cchef to-base62 -i 'Hello, World!'

Output:

1wJfrzvdbtXUOlUjUf

To Base64

Encodes raw data into an ASCII Base64 string.

Alternative to base64. base64 wraps output at 76 columns by default; cchef emits one unbroken line, and the alphabet is configurable to match variants base64 cannot produce.

Options

Flag Type Default Description
--alphabet string A-Za-z0-9+/= The Base64 alphabet (supercedes ranges like A-Z). A 64-character alphabet produces no padding.

Simple example

cchef to-base64 -i 'Hello, World!'

Output:

SGVsbG8sIFdvcmxkIQ==

Custom alphabet (URL-safe, no padding)

printf '\xfb\xff' | cchef to-base64 --alphabet 'A-Za-z0-9-_'

Output:

-_8

To Base85

Base85 (Ascii85) encodes arbitrary byte data using 85 printable ASCII characters, more space-efficient than Base64.

Options

Flag Type Default Description
--alphabet string !-u The 85-character alphabet (Standard, Z85, or IPv6).
--include-delimiter bool false Wrap the output in <~~> delimiters.

Simple example

cchef to-base85 -i 'Man '

Output:

9jqo^

With delimiters

cchef to-base85 --include-delimiter -i 'Man '

Output:

<~9jqo^~>

To Base92

Base92 encodes arbitrary byte data using 91 printable ASCII characters. Takes no options.

Simple example

cchef to-base92 -i 'Hello!!'

Output:

;K_$aOTo&

To BCD

Encodes a decimal number as Binary-Coded Decimal, representing each digit with a fixed group of bits under the chosen scheme.

Options

Flag Type Default Description
--scheme option 8 4 2 1 Encoding scheme: 8 4 2 1, 7 4 2 1, 4 2 2 1, 2 4 2 1, 8 4 -2 -1, Excess-3, IBM 8 4 2 1.
--packed boolean true Two digits per byte (packed) vs one digit per byte (unpacked).
--signed boolean false Append a sign nibble (C = +, D = -).
--output-format option Nibbles Output representation: Nibbles, Bytes, or Raw.

Simple example

cchef to-bcd -i '1234'

Output:

0001 0010 0011 0100

Packed, signed bytes

cchef to-bcd --packed --signed --output-format Bytes -i '1234567890'

Output:

00000001 00100011 01000101 01100111 10001001 00001100

To Bech32

Encodes data as a Bech32 or Bech32m string (BIP-0173 / BIP-0350), with a Human-Readable Part (HRP) and a checksum. The input is raw bytes or a hex string. In Bitcoin SegWit mode the witness version is prepended and the witness-program length is validated per BIP-0141; in Generic mode any data is encoded. The output is capped at 90 characters.

Options

Flag Type Default Description
--human-readable-part-hrp string bc The HRP (e.g. bc, tb, age).
--encoding option Bech32 Bech32 or Bech32m.
--input-format option Raw bytes Raw bytes or Hex.
--mode option Generic Generic or Bitcoin SegWit.
--witness-version number 0 SegWit witness version (0-16); only used in Bitcoin SegWit mode.

Simple example

cchef to-bech32 -i 'Hello'

Output:

bc1fpjkcmr0gzsgcg

Bitcoin SegWit address

echo -n '751e76e8199196d454941c45d1b3a323f1433bd6' \
    | cchef to-bech32 --input-format Hex --mode 'Bitcoin SegWit' --witness-version 0

Output:

bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4

To Binary

Displays the input as a binary string, each byte zero-padded to the given length.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Comma, Semi-colon, Colon, Line feed, CRLF, None.
--byte-length number 8 Number of bits per byte.

Simple example

cchef to-binary -i 'Hi'

Output:

01001000 01101001

To Braille

Converts text to six-dot braille symbols using CyberChef's braille lookup. Letters are matched case-insensitively; characters with no braille mapping are passed through unchanged.

This operation takes no options.

Simple example

cchef to-braille -i 'Hello'

Output:

⠓⠑⠇⠇⠕

To COBS

Encodes bytes with Consistent Overhead Byte Stuffing, which removes every zero byte from the data by replacing it with a count of how far away the next one is. The result never contains a zero, so a zero can then be used to mark where one message ends and the next begins — which is what the encoding is for. It costs at least one byte, and one more for every 254 bytes without a zero.

Takes no options.

Simple example

cchef from-hex -i "00 11 22 00 33" | cchef to-cobs | cchef to-hex

Output:

01 03 11 22 02 33

To Charcode

Converts text to its unicode character codes, in the given base.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Comma, Semi-colon, Colon, Line feed, CRLF.
--base number 16 Radix of the character codes (2–36).

Simple example

cchef to-charcode -i 'AB'

Output:

41 42

Base 10

cchef to-charcode --base 10 -i 'AB'

Output:

65 66

To Decimal

Converts the input to a delimited list of decimal byte values.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Comma, Semi-colon, Colon, Line feed, CRLF.
--support-signed-values bool false Treat each byte as a signed value (−128…127).

Simple example

cchef to-decimal -i 'ABC'

Output:

65 66 67

To Float

Interprets the input bytes as IEEE 754 floating-point numbers and prints their decimal values.

Options

Flag Type Default Description
--endianness option Big Endian Big Endian or Little Endian.
--size option Float (4 bytes) Float (4 bytes) (single precision) or Double (8 bytes) (double precision).
--delimiter option Space Separator between numbers: Space, Comma, Semi-colon, Colon, Line feed, CRLF.

The input length must be a multiple of the chosen size (4 or 8 bytes).

Simple example

cchef from-hex -i '3f0000003f000000' | cchef to-float

Output:

0.5 0.5

Big-endian double precision

cchef from-hex -i '3fe0000000000000' | cchef to-float --size 'Double (8 bytes)'

Output:

0.5

To Hex

Converts the input to hexadecimal bytes separated by the chosen delimiter.

Alternative to xxd and od for a flat hex dump. For the classic address/hex/ASCII columns use To Hexdump; the delimiter here is a CyberChef option, not xxd's fixed layout.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Percent, Comma, Semi-colon, Colon, Line feed, CRLF, 0x, 0x with comma, \x, None.
--bytes-per-line number 0 Break the output into lines of this many bytes. 0 writes one long line.

Simple example

cchef to-hex -i 'Hello'

Output:

48 65 6c 6c 6f

Alternative delimiters

cchef to-hex --delimiter 'Colon' -i 'Hello'

Output:

48:65:6c:6c:6f
cchef to-hex --delimiter '0x with comma' -i 'abc'

Output:

0x61,0x62,0x63

Wrapping to a fixed width

The break comes after the delimiter, so each line but the last ends with one:

cchef to-hex --bytes-per-line 4 -i 'Hello World!'

Output:

48 65 6c 6c 
6f 20 57 6f 
72 6c 64 21

To Hex Content

Converts special (non-alphanumeric) characters to SNORT hex-content notation, wrapping runs of hex bytes in |...| (e.g. foo=bar becomes foo|3d|bar).

Options

Flag Type Default Description
--convert option Only special chars Which bytes to hex-encode: Only special chars, Only special chars including spaces, or All chars.
--print-spaces-between-bytes boolean false Separate consecutive hex bytes within a block with spaces.

Simple example

cchef to-hex-content -i 'foo=bar'

Output:

foo|3d|bar

Including spaces, with a multi-byte block

cchef to-hex-content --convert 'Only special chars including spaces' -i 'Hello, World!'

Output:

Hello|2c20|World|21|

All chars, spaced

cchef to-hex-content --convert 'All chars' --print-spaces-between-bytes -i 'foo=bar'

Output:

|66 6f 6f 3d 62 61 72|

To Hexdump

Creates a hexdump of the input: an offset column, the hexadecimal value of each byte, and an ASCII preview alongside (non-printable bytes shown as .).

Alternative to xxd, hexdump -C and od. The layout matches CyberChef's, not any one of those tools exactly.

Options

Flag Type Default Description
--width number 16 Bytes per line (1–65536).
--upper-case-hex boolean false Upper-case the hex and offset columns.
--include-final-length boolean false Append a final line with the total byte length.
--unix-format boolean false Preview only ASCII 0x200x7e; otherwise Latin-1 printable characters are shown.

Simple example

cchef to-hexdump -i 'Hello, World!'

Output:

00000000  48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21           |Hello, World!|

Narrow width, upper-case, with final length

cchef to-hexdump --width 8 --upper-case-hex --include-final-length -i 'Hello, World!'

Output:

00000000  48 65 6C 6C 6F 2C 20 57  |Hello, W|
00000008  6F 72 6C 64 21           |orld!|
0000000d

To HTML Entity

Converts characters to HTML character entities. By default only characters with a named entity (and code points above 255) are converted; the rest pass through. Use --convert-all-characters and --convert-to to control the output form.

Options

Flag Type Default Description
--convert-all-characters boolean false Convert every character, not just those with a named entity.
--convert-to option Named entities Named entities, Numeric entities (&#233;), or Hex entities (&#xe9;).

Simple example

cchef to-html-entity -i 'a & b < "c"'

Output:

a &amp; b &lt; &quot;c&quot;

Numeric entities, converting everything

cchef to-html-entity --convert-all-characters --convert-to 'Numeric entities' -i ''

Output:

&#72;&#233;

To MessagePack

Converts JSON to a MessagePack encoded byte buffer. MessagePack is a compact binary serialization format for the same data model as JSON. Non-integer numbers are always encoded as 64-bit floats, and object keys are emitted in JavaScript enumeration order (integer-index keys first in ascending order, then the remaining keys in insertion order), matching CyberChef's notepack.io backing library. Output is raw bytes; pipe through to-hex to view it.

Simple example

echo -n '{"a":1,"b":2,"c":3}' | cchef to-messagepack | cchef to-hex

Output:

83 a1 61 01 a1 62 02 a1 63 03

Key ordering (integer-index keys are emitted first, in ascending order):

echo -n '{"b":1,"2":2,"1":3}' | cchef to-messagepack | cchef to-hex

Output:

83 a1 31 03 a1 32 02 a1 62 01

Float (non-integers encode as a 64-bit float):

echo -n '1.5' | cchef to-messagepack | cchef to-hex

Output:

cb 3f f8 00 00 00 00 00 00

To Modhex

Converts the input to modhex bytes separated by the chosen delimiter. Modhex substitutes the 16 hex nibbles with the consonant alphabet cbdefghijklnrtuv.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Percent, Comma, Semi-colon, Colon, Line feed, CRLF, None.
--bytes-per-line number 0 Insert a line break after this many bytes (0 = never).

Simple example

cchef to-modhex -i 'aberystwyth'

Output:

hb hd hg id ik ie if ii ik if hj

Alternative delimiter with line wrapping

cchef to-modhex --delimiter Comma --bytes-per-line 4 -i 'aberystwyth'

Output:

hb,hd,hg,id,
ik,ie,if,ii,
ik,if,hj

To Octal

Converts the input to octal bytes separated by the chosen delimiter.

Options

Flag Type Default Description
--delimiter option Space One of: Space, Comma, Semi-colon, Colon, Line feed, CRLF.

Simple example

cchef to-octal -i 'Hello'

Output:

110 145 154 154 157

Alternative delimiter

cchef to-octal --delimiter 'Comma' -i 'Hello'

Output:

110,145,154,154,157

To Punycode

Converts Unicode to Punycode (RFC 3492). By default the whole input is encoded as a single Punycode string (basic ASCII code points keep a trailing - delimiter). With the Internationalised domain name option, each non-ASCII label of a domain name (or the domain of an email address) is encoded and prefixed with xn--, ASCII labels passing through unchanged.

Options

Flag Type Default Description
--internationalised-domain-name boolean false Encode a domain name (per-label xn--) rather than a raw Punycode string.

Simple example

cchef to-punycode -i 'münchen'

Output:

mnchen-3ya

Complex example (encode an internationalised domain name):

cchef to-punycode --internationalised-domain-name -i 'münchen.de'

Output:

xn--mnchen-3ya.de

To Quoted Printable

Encodes bytes as Quoted-Printable (RFC 2045): bytes outside the printable set become =XX, lines are kept to 76 characters with =-terminated soft breaks, and trailing whitespace is escaped.

Options

This operation takes no options.

Simple example

cchef to-quoted-printable -i 'a=b & café'

Output:

a=3Db & caf=C3=A9

Unescape Unicode Characters

Converts unicode-escaped character notation back into the raw characters it represents. Text outside the escapes is passed through unchanged. With the U+ prefix, 4- to 6-digit escapes are accepted (so astral code points work); the \u and %u prefixes take exactly 4 digits.

Options

Flag Type Default Description
--prefix option \u Escape prefix to decode: \u, %u, or U+.

Simple example

cchef unescape-unicode-characters -i 'H\u00E9llo'

Output:

Héllo

Astral code point with the U+ prefix

cchef unescape-unicode-characters --prefix 'U+' -i 'U+1F600'

Output:

😀

URL Decode

Converts percent-encoded characters back to their raw values.

Options

Flag Type Default Description
--treat-as-space bool true Treat + as a space (form encoding).

Simple example

cchef url-decode -i 'Hello%20World%21'

Output:

Hello World!

URL Encode

Encodes problematic characters into percent-encoding.

Options

Flag Type Default Description
--encode-all-special-chars bool false When false, characters valid in URLs (e.g. :/?#[]@!$&'()*+,;=) are kept; when true, everything except A-Za-z0-9 is encoded.

Simple example

cchef url-encode -i 'Hello World!'

Output:

Hello%20World!

Encode all special characters

cchef url-encode --encode-all-special-chars -i 'Hello World!'

Output:

Hello%20World%21

YAML to JSON

Converts YAML to JSON (pretty-printed with 4-space indent). Anchors and aliases are resolved, timestamps become ISO-8601 strings, and numbers become JSON numbers (so integers beyond 2⁵³ lose precision, matching CyberChef). Duplicate mapping keys are rejected.

Fidelity note: CyberChef reads YAML with the JavaScript js-yaml library. cchef parses with Go's go.yaml.in/yaml/v3 and then re-resolves each plain scalar against the YAML 1.2 core schema, because the Go library also honours YAML 1.1 forms that js-yaml does not: a leading zero is not octal (017 is 17), there is no binary form (0b101 is text), an underscore does not separate digits (1_000 is text), and there is no timestamp type, so a date is the text that was written. Input holding no document at all — only whitespace or comments — is refused, as js-yaml refuses it; an explicit --- is an empty document and reads as null.

Simple example

cchef yaml-to-json -i 'name: cchef
tags:
  - cli
  - yaml
active: true'

Output:

{
    "name": "cchef",
    "tags": [
        "cli",
        "yaml"
    ],
    "active": true
}