Tool for encoding messages in unary code according to the Chuck Norris method of encoding a series of N consecutive bits by replacing 1 with 0 and 0 with 00 respectively followed by N zeros.
Chuck Norris Unary Code - dCode
Tag(s) : Character Encoding
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The Chuck Norris code is a unary code, with a single character: zero. The unary code is a conversion of the binary code according to the sequences of 0 and 1 repeated.
A sequence of N times 0 is coded 00 followed by N times 0.
A sequence of N times 1 is coded 0 followed by N times 0.
Example: Code the message 00011110 by dividing it into segments of consecutive 0 and 1: 000,1111,0 then transcribed:
000 | 00 000 |
1111 | 0 0000 |
0 | 00 0 |
By default the plain message is first coded in 7bit binary (via the ASCII table).
The message is unary, normally composed only of zeros. To recompose the corresponding binary, segment the sequences of zeros in groups of 2. The first set of zeros in each group is alternately either 0 (for a 1 bit) or 00 (for a 0 bit), the second set of zeros corresponds to the number of repetitions of this bit.
Example: 0 0000 (ie 0 followed by 4 zeros 0000) for 1 repeated 4 times or 1111
Example: 00 0 (ie' 00 'followed by 1 zero) for' 0 'repeated once or' 0 '
The message consists of a single character: the 0 (and a separator, usually a space character).
The message alternates 0 and 00 every 2 groups of 0.
The 0 character can be substituted by a search and replace by any other character.
ASCII encoding can be replaced by another type of encoding (A1Z26, Unicode, etc.)
ASCII encoding can be 7-bit or 8-bit.
Chuck Norris is the name given by the Codingame website for one of his tests that deals with this unary code.
dCode retains ownership of the "Chuck Norris Unary Code" source code. Any algorithm for the "Chuck Norris Unary Code" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Chuck Norris Unary Code" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Chuck Norris Unary Code" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Chuck Norris Unary Code" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Chuck Norris Unary Code on dCode.fr [online website], retrieved on 2025-04-16,