Hexdump for Windows
The freeware Windows program
hexdump.exe
is a simplified version of the Linux utility to display file contents in hexadecimal.
Synopsis and example
>hexdump -h Usage: hexdump [OPTION]... [FILE] Display contents of FILE in hexadecimal. With no FILE, read standard input. -C Canonical hex+ASCII display: add display of bytes as printable ASCII chars -O omit offset column -H add ASCII display with escaped Html entities (e.g. '&' --> '&') -R add display of bytes in Raw format -V display version information and exit -h display this help and exit >hexdump abc.txt 000000 61 62 63 >hexdump mexico-utf8.txt 000000 4f 6c c3 a1 20 6d 75 6e 64 6f 20 4d c3 a9 78 69 000010 63 6f 20 3c 26 3e 0d 0a
The options -H
, -R
and -O
are new options we included because we found them useful.
Canonical hex + ASCII display
The original file is the string "Olá mundo México <&>"
followed by a new line.
>hexdump -C mexico-utf8.txt 000000 4f 6c c3 a1 20 6d 75 6e 64 6f 20 4d c3 a9 78 69 Ol.. mundo M..xi 000010 63 6f 20 3c 26 3e 0d 0a co <&>..
Do for multiple files. Here are 3 different variants of encodings and line endings.
>for %f in (mexico*.txt) do @echo %f & hexdump -C %f mexico-latin1.txt 000000 4f 6c e1 20 6d 75 6e 64 6f 20 4d e9 78 69 63 6f Ol. mundo M.xico 000010 20 3c 26 3e 0d 0a <&>.. mexico-utf8-bom-unix.txt 000000 ef bb bf 4f 6c c3 a1 20 6d 75 6e 64 6f 20 4d c3 ...Ol.. mundo M. 000010 a9 78 69 63 6f 20 3c 26 3e 0a .xico <&>. mexico-utf8.txt 000000 4f 6c c3 a1 20 6d 75 6e 64 6f 20 4d c3 a9 78 69 Ol.. mundo M..xi 000010 63 6f 20 3c 26 3e 0d 0a co <&>..
In a batch file, replace %f
with %%f
.
- The letter á (U+00E1) is encoded as
e1
in Latin-1 but as the two bytesc3 a1
in UTF-8. - The "Unix (LF)" new line is the single byte
0a
but is represented by two bytes0d 0a
in a "Windows (CR LF)" file. - The UTF-8 Byte Order Mark (BOM) in the second example consists of the three bytes
ef bb bf
.
Omit the offset column
Use the -O
(capital letter 'O') option to omit the offset column on the left.
>hexdump 1-23.txt 000000 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 000010 37 38 39 30 31 32 33 >hexdump -O 1-23.txt 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33
We find this useful if we want to get the contents of the file in pure hex form.
Escape HTML entities in canonical display
Use the -H
option to show the ASCII display with escaped HTML entities (e.g. "&" → "&")
>hexdump -H mexico-utf8.txt 000000 4f 6c c3 a1 20 6d 75 6e 64 6f 20 4d c3 a9 78 69 Ol.. mundo M..xi 000010 63 6f 20 3c 26 3e 0d 0a co <&>..
Useful if you are copying and pasting into the source of an HTML web page. We use this option all the time when showing hexdump output in our web pages.
Display raw bytes
>hexdump -R mexico-latin1.txt 000000 4f 6c e1 20 6d 75 6e 64 6f 20 4d e9 78 69 63 6f Olß mundo MÚxico 000010 20 3c 26 3e 0d 0a <&>..
This displays the raw bytes on the right, which may not display so good on a Windows console, but you can redirect to a new file.
hexdump -R mexico-latin1.txt > mexico-latin1.out
Or you can change the code page: 28591 is Latin-1 (ISO-8859-1) and 65001 is UTF-8.
>chcp 28591 Active code page: 28591 >hexdump -R mexico-latin1.txt 000000 4f 6c e1 20 6d 75 6e 64 6f 20 4d e9 78 69 63 6f Olá mundo México 000010 20 3c 26 3e 0d 0a <&>.. >chcp 65001 Active code page: 65001 >hexdump -R mexico-utf8.txt 000000 4f 6c c3 a1 20 6d 75 6e 64 6f 20 4d c3 a9 78 69 Olá mundo Méxi 000010 63 6f 20 3c 26 3e 0d 0a co <&>..
Read from standard input
>type 1-23.txt 12345678901234567890123 >type 1-23.txt | hexdump -C 000000 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 1234567890123456 000010 37 38 39 30 31 32 33 7890123 >echo abc |hexdump -C 000000 61 62 63 20 0a abc .
Note the extra LF character added by echo in Windows (and the space between the 'c' and the '|').
To avoid this behaviour, use the SET command with the "/p" option and make sure there are no extra spaces before the '|' pipe symbol.
>echo | set /p=abc| hexdump -C 000000 61 62 63 abc
Download
- Binaries: hexdump-2.1.0.zip (58 kB)
[sha1=fdfb7fc5e1690a482a06d7cdb056afda8d303948]
. The latest version is 2.1.0 compiled and signed on 2023-11-01.
Install
To install, just copy the file hexdump.exe
to a folder on your
Windows PATH,
for example C:\Windows
.
You may need administrator permissions to copy the file.
We recommend you set up a C:\Bin directory for files like this.
Revision History
-O
option to exclude the offset column.
::CORRECT v2.0.3: > base64 -d -s V4k7jhr1b3Cmx4dBLYyCaw | hexdump 000000 57 89 3b 8e 1a f5 6f 70 a6 c7 87 41 2d 8c 82 6b 000010 09 3b 8e 1a f5 6f 70 a6 c7 87 41 2d 8c 82 ::OLD - truncated after 4th byte by 0x1a > base64 -d -s V4k7jhr1b3Cmx4dBLYyCaw | hexdump 000000 57 89 3b 8eThanks to Carlos at skoolofthought for pointing this out.
Contact us
To report a bug, comment on this page or to contact us, please send us a message.
This page last updated 1 November 2023.