What program can I use to convert text into binary numbers?

You could try ppt from the bsdgames package. It will output ASCII as a binary punchcard.

You could also use a python script:

$ python -c 'for char in "Hello, world!": print(bin(ord(char)))'
0b1001000
0b1100101
0b1101100
0b1101100
0b1101111
0b101100
0b100000
0b1110111
0b1101111
0b1110010
0b1101100
0b1100100
0b100001

After further consideration and removing my first answer, I now note that you don't want to see the readable text in a binary (e.g. with the strings utility), but see text in binary form.

So, I think the KDE utility, okteta is just what you want, and it is available in the repositories and can be installed with

sudo apt-get install okteta

It allows you to view text files in binary form (see the second screenshot below), and you can click the tab at the bottom of the page to switch between binary form, hexadecimal, decimal, and octal. You can even create a new file and start entering text and, if you have the binary mode selected, the characters typed will be shown in binary, just like in the online converter you linked to. The screenshot directly below shows an example of this:

enter image description here

This application does exactly what you have specified in the question, and it is a gui as well, so that seems to tick all the boxes.

Okteta seems to be the most fully featured editor available, and there are also modules and plugins that give additional functionality.

enter image description here


I was wondering if od had the option to output as binary (vs. in hex with od -t x1z). Unfortunately not, but a good alternative is xxd found at U&L:

echo 'Hello, world!' | xxd -b
0000000: 01001000 01100101 01101100 01101100 01101111 00101100  Hello,
0000006: 00100000 01110111 01101111 01110010 01101100 01100100   world
000000c: 00100001 00001010                                      !.

GHex - a hex editor for GNOME

GHex allows the user to load data from any file, view and edit it in either hex or ascii.

Useful for debugging problems with object code or encodings.

Install via the software center ghex Install ghex

enter image description here