 <p>if you want them as you've described them, just tack on some zero's to the front, it won't change the binary value </p> <pre><code>private static string AddZeros(string r) { while (r.Length &lt; 8) r = "0" + r; return r; } </code></pre>