xxd - macOS


xxd transforms binary files into a human-readable format by displaying the raw data in hexadecimal and ASCII character representation. It offers various options for customizing the output format and inspecting binary content.


xxd [options] <filename>


  • -a (ASCII) – Display ASCII representation of data
  • -b (Bytes) – Output data as bytes, ignoring EOLs
  • -c (Characters) – Output data as characters, ignoring EOLs
  • -d (Decimal) – Output data as decimal values
  • -e (Offset) – Prepend each line with a byte offset
  • -g (Groups) – Group output into 8-byte blocks
  • -i (Inhibit) – Inhibit default actions (e.g., skipping zero blocks)
  • -j (Block Size) – Start output at the specified block size
  • -l (Lines) – Limit output to the specified number of lines
  • -m (Master Offset) – Specify an overall offset to be added to all offsets
  • -n (Nl Output) – Separate lines with NL (newline) characters
  • -o (Offset) – Start output at the specified offset
  • -ps (Pause) – Pause after each screenful of output
  • -r (Reverse) – Output in reverse order
  • -s (Block Size) – Specify the output block size (in bytes)
  • -u (Ulitmate) – Disable all default actions
  • -v (Verbose) – Enable verbose output


  • View file as hex and ASCII: xxd -a myfile.bin
  • Display bytes in groups of 8: xxd -g -b myfile.bin
  • Dump 10 lines of data, starting from 100th byte: xxd -l 10 -o 100 myfile.bin
  • Inhibit defaults and separate lines with NL: xxd -u -n myfile.bin

Common Issues

  • Empty output: Ensure the file exists and is readable.
  • Incorrect parsing: Verify that the file format corresponds to the expected values.
  • Long output: Use the -l option to limit output lines or -s to restrict the block size.


  • Tailing hexdumps: tail -c 100 filename | xxd -a
  • Inspecting specific bytes: dd if=file skip=offset count=length | xxd
  • hexdump – Similar tool with a more verbose output format
  • od – Another command-line utility for inspecting binary data