Last updated: Apr 6, 2024
Reading time·3 min
Microsoft developed a Hex editor VS Code extension that can be used to view and edit binary files.
You can install the extension by:
Ctrl
+ Shift
+ X
on Windows or LinuxCommand
+ Shift
+ X
on macOSMake sure to install the Hex Editor extension that was developed by Microsoft as shown in the code sample.
To open a binary file:
An alternative way to open a file is to:
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.Once you open the file, you will be able to view the binary data and the decoded text.
If you click on a specific cell, more detailed information is shown.
You can edit the binary file by selecting a specific cell and typing a new value.
You can save the changes with:
Ctrl
+ s
on Windows and Linux.Command
+ s
on macOS.If you need to switch to the default text editor:
The hex editor supports opening various files, e.g. text files, images, binary
(.bin
) files, etc.
You can also set the Hex editor as the default editor for certain file types by editing your settings.json file.
You can open your settings.json
file by:
Ctrl
+ Shift
+ P
(or Command
+ Shift
+ P
on macOS).F1
to open the Command Palette.settings.json
.For example, the following lines of code set the hex editor as the default
editor for files with .hex
or .ini
extensions.
"workbench.editorAssociations": { "*.hex": "hexEditor.hexedit", "*.ini": "hexEditor.hexedit" },
The hex editor supports:
You can learn more about the related topics by checking out the following tutorials: