Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a simple utility like printf that'll give me a "binary representation", i.e. a string like "01010010", from an input string? It would need to support multi-byte encodings.

share|improve this question
i was going to say od, but it doesnt output binary. googling about using od for binary output, found this, might be helpful: blog.2of1.org/2011/03/24/binary-output-using-od-cut-and-perl – marcelog Jul 30 '11 at 0:35
up vote 12 down vote accepted

xxd -b


share|improve this answer
Nice, thank you! My Google didn't find it… :o) – deceze Jul 30 '11 at 0:50

You can also do this (and many other things) using figlet with the binary font.

$ echo foo | figlet -f binary
01100110 01101111 01101111 
share|improve this answer
@bahamat: I love the style of figlets big font output (+1 for that :) , but I there is not 'binary' format for version 2.2.2.. – Peter.O Jul 30 '11 at 19:17
I'm using 2.2.4, and I have the binary font. You have to download it from figlet.org (I already posted the link). – bahamat Jul 30 '11 at 19:52
I downloaded binary.flf, and it works to just add a new .flf file to /usr/share/figlet... Now that I've actually tried it, I'll mention that unless you manually modify binary.flf, it does not convert spaces to binary... – Peter.O Jul 31 '11 at 1:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.