10進数表記と16進数表記(0xあり)の文字数の比較表

10進数の文字数と、16進数の文字数の比較表です。
（末尾に 'L' や 'LL' が付く場合は考慮していません）

10<sup>12</sup> (13文字)から16進数の方が短め
10<sup>17</sup> (18文字)から16進数の方が短い


| 10進数 | | | | 16進数 |
|--:|:-:|:-:|:-:|:--|
| <code>0</code> | 1 | < | 3 | <code>0x0</code> |
| <code>9</code> | 1 | < | 3 | <code>0x9</code> |
| <code>10</code> | 2 | < | 3 | <code>0xa</code> |
| <code>15</code> | 2 | < | 3 | <code>0xf</code> |
| <code>16</code> | 2 | < | 4 | <code>0x10</code> |
| <code>99</code> | 2 | < | 4 | <code>0x63</code> |
| <code>100</code> | 3 | < | 4 | <code>0x64</code> |
| <code>255</code> | 3 | < | 4 | <code>0xff</code> |
| <code>256</code> | 3 | < | 5 | <code>0x100</code> |
| <code>999</code> | 3 | < | 5 | <code>0x3e7</code> |
| <code>1000</code> | 4 | < | 5 | <code>0x3e8</code> |
| <code>4095</code> | 4 | < | 5 | <code>0xfff</code> |
| <code>4096</code> | 4 | < | 6 | <code>0x1000</code> |
| <code>9999</code> | 4 | < | 6 | <code>0x270f</code> |
| <code>10000</code> | 5 | < | 6 | <code>0x2710</code> |
| <code>65535</code> | 5 | < | 6 | <code>0xffff</code> |
| <code>65536</code> | 5 | < | 7 | <code>0x10000</code> |
| <code>99999</code> | 5 | < | 7 | <code>0x1869f</code> |
| <code>100000</code> | 6 | < | 7 | <code>0x186a0</code> |
| <code>999999</code> | 6 | < | 7 | <code>0xf423f</code> |
| <code>1000000</code> | 7 | = | 7 | <code>0xf4240</code> |
| <code>1048575</code> | 7 | = | 7 | <code>0xfffff</code> |
| <code>1048576</code> | 7 | < | 8 | <code>0x100000</code> |
| <code>9999999</code> | 7 | < | 8 | <code>0x98967f</code> |
| <code>10000000</code> | 8 | = | 8 | <code>0x989680</code> |
| <code>16777215</code> | 8 | = | 8 | <code>0xffffff</code> |
| <code>16777216</code> | 8 | < | 9 | <code>0x1000000</code> |
| <code>99999999</code> | 8 | < | 9 | <code>0x5f5e0ff</code> |
| <code>100000000</code> | 9 | = | 9 | <code>0x5f5e100</code> |
| <code>268435455</code> | 9 | = | 9 | <code>0xfffffff</code> |
| <code>268435456</code> | 9 | < | 10 | <code>0x10000000</code> |
| <code>999999999</code> | 9 | < | 10 | <code>0x3b9ac9ff</code> |
| <code>1000000000</code> | 10 | = | 10 | <code>0x3b9aca00</code> |
| <code>4294967295</code> | 10 | = | 10 | <code>0xffffffff</code> |
| <code>4294967296</code> | 10 | < | 11 | <code>0x100000000</code> |
| <code>9999999999</code> | 10 | < | 11 | <code>0x2540be3ff</code> |
| <code>10000000000</code> | 11 | = | 11 | <code>0x2540be400</code> |
| <code>68719476735</code> | 11 | = | 11 | <code>0xfffffffff</code> |
| <code>68719476736</code> | 11 | < | 12 | <code>0x1000000000</code> |
| <code>99999999999</code> | 11 | < | 12 | <code>0x174876e7ff</code> |
| <code>100000000000</code> | 12 | = | 12 | <code>0x174876e800</code> |
| <code>999999999999</code> | 12 | = | 12 | <code>0xe8d4a50fff</code> |
| <code>1000000000000</code> | 13 | > | 12 | <code>0xe8d4a51000</code> |
| <code>1099511627775</code> | 13 | > | 12 | <code>0xffffffffff</code> |
| <code>1099511627776</code> | 13 | = | 13 | <code>0x10000000000</code> |
| <code>9999999999999</code> | 13 | = | 13 | <code>0x9184e729fff</code> |
| <code>10000000000000</code> | 14 | > | 13 | <code>0x9184e72a000</code> |
| <code>17592186044415</code> | 14 | > | 13 | <code>0xfffffffffff</code> |
| <code>17592186044416</code> | 14 | = | 14 | <code>0x100000000000</code> |
| <code>99999999999999</code> | 14 | = | 14 | <code>0x5af3107a3fff</code> |
| <code>100000000000000</code> | 15 | > | 14 | <code>0x5af3107a4000</code> |
| <code>281474976710655</code> | 15 | > | 14 | <code>0xffffffffffff</code> |
| <code>281474976710656</code> | 15 | = | 15 | <code>0x1000000000000</code> |
| <code>999999999999999</code> | 15 | = | 15 | <code>0x38d7ea4c67fff</code> |
| <code>1000000000000000</code> | 16 | > | 15 | <code>0x38d7ea4c68000</code> |
| <code>4503599627370495</code> | 16 | > | 15 | <code>0xfffffffffffff</code> |
| <code>4503599627370496</code> | 16 | = | 16 | <code>0x10000000000000</code> |
| <code>9999999999999999</code> | 16 | = | 16 | <code>0x2386f26fc0ffff</code> |
| <code>10000000000000000</code> | 17 | > | 16 | <code>0x2386f26fc10000</code> |
| <code>72057594037927935</code> | 17 | > | 16 | <code>0xffffffffffffff</code> |
| <code>72057594037927936</code> | 17 | = | 17 | <code>0x100000000000000</code> |
| <code>99999999999999999</code> | 17 | = | 17 | <code>0x16345785d89ffff</code> |
| <code>100000000000000000</code> | 18 | > | 17 | <code>0x16345785d8a0000</code> |
| <code>999999999999999999</code> | 18 | > | 17 | <code>0xde0b6b3a763ffff</code> |
| <code>1000000000000000000</code> | 19 | > | 17 | <code>0xde0b6b3a7640000</code> |
| <code>1152921504606846975</code> | 19 | > | 17 | <code>0xfffffffffffffff</code> |
| <code>1152921504606846976</code> | 19 | > | 18 | <code>0x1000000000000000</code> |
| <code>9999999999999999999</code> | 19 | > | 18 | <code>0x8ac7230489e7ffff</code> |
| <code>10000000000000000000</code> | 20 | > | 18 | <code>0x8ac7230489e80000</code> |
| <code>18446744073709551615</code> | 20 | > | 18 | <code>0xffffffffffffffff</code> |