Binär
Liknande
- Oktal
- Decimal
- Hexadecimal
Fenomen
Exempel
Nummer | Talbasen (radix) 2 |
---|---|
1 | 2^0 |
2 | 2^1 |
4 | 2^2 |
8 | 2^3 |
16 | 2^4 |
32 | 2^5 |
64 | 2^6 |
128 | 2^7 |
256 | 2^8 |
512 | 2^9 |
1024 | 2^10 |
2048 | 2^11 |
4096 | 2^12 |
8192 | 2^13 |
Länkar
Konvertera mellan olika talbaser (radix) med Javascript
var ConvertBase = function (num) {
return {
from : function (baseFrom) {
return {
to : function (baseTo) {
return parseInt(num, baseFrom).toString(baseTo);
}
};
}
};
};
ConvertBase.bin2oct = function (num) {
return ConvertBase(num).from(2).to(8);
};
ConvertBase.bin2dec = function (num) {
return ConvertBase(num).from(2).to(10);
};
ConvertBase.bin2hex = function (num) {
return ConvertBase(num).from(2).to(16);
};
ConvertBase.oct2bin = function (num) {
return ConvertBase(num).from(8).to(2);
};
ConvertBase.oct2dec = function (num) {
return ConvertBase(num).from(8).to(10);
};
ConvertBase.oct2hex = function (num) {
return ConvertBase(num).from(8).to(16);
};
ConvertBase.dec2bin = function (num) {
return ConvertBase(num).from(10).to(2);
};
ConvertBase.dec2oct = function (num) {
return ConvertBase(num).from(10).to(8);
};
ConvertBase.dec2hex = function (num) {
return ConvertBase(num).from(10).to(16);
};
ConvertBase.hex2bin = function (num) {
return ConvertBase(num).from(16).to(2);
};
ConvertBase.hex2oct = function (num) {
return ConvertBase(num).from(16).to(8);
};
ConvertBase.hex2dec = function (num) {
return ConvertBase(num).from(16).to(10);
};
table = document.createElement('table');
for(i = 0; i < 256; i++) {
tr = document.createElement('tr');
char = document.createElement('td');
char.innerHTML = String.fromCodePoint(i);
tr.appendChild(char);
dec = document.createElement('td');
dec.innerHTML = i;
tr.appendChild(dec);
hex = document.createElement('td');
hex.innerHTML = ConvertBase.dec2hex(i);
tr.appendChild(hex);
oct = document.createElement('td');
oct.innerHTML = ConvertBase.dec2oct(i);
tr.appendChild(oct);
bin = document.createElement('td');
bin.innerHTML = ConvertBase.dec2bin(i);
tr.appendChild(bin);
hexpad = document.createElement('td');
hexpad.innerHTML = 'U+'+ConvertBase.dec2hex(i).padStart(4, 0);
tr.appendChild(hexpad);
binpad = document.createElement('td');
binpad.innerHTML = ConvertBase.dec2bin(i).padStart(8,0);
tr.appendChild(binpad);
table.appendChild(tr);
text = document.createTextNode("\n");
table.append(text);
}
document.body.appendChild(table);
Radix
Symbol | Dec (10) | Hex (16) | Oct (8) | Bin (2) |
---|---|---|---|---|
0 | 0 | 0 | 0 | |
1 | 1 | 1 | 1 | |
2 | 2 | 2 | 10 | |
3 | 3 | 3 | 11 | |
4 | 4 | 4 | 100 | |
5 | 5 | 5 | 101 | |
6 | 6 | 6 | 110 | |
7 | 7 | 7 | 111 | |
8 | 8 | 10 | 1000 | |
9 | 9 | 11 | 1001 | |
10 | a | 12 | 1010 | |
11 | b | 13 | 1011 | |
12 | c | 14 | 1100 | |
13 | d | 15 | 1101 | |
14 | e | 16 | 1110 | |
15 | f | 17 | 1111 | |
16 | 10 | 20 | 10000 | |
17 | 11 | 21 | 10001 | |
18 | 12 | 22 | 10010 | |
19 | 13 | 23 | 10011 | |
20 | 14 | 24 | 10100 | |
21 | 15 | 25 | 10101 | |
22 | 16 | 26 | 10110 | |
23 | 17 | 27 | 10111 | |
24 | 18 | 30 | 11000 | |
25 | 19 | 31 | 11001 | |
26 | 1a | 32 | 11010 | |
27 | 1b | 33 | 11011 | |
28 | 1c | 34 | 11100 | |
29 | 1d | 35 | 11101 | |
30 | 1e | 36 | 11110 | |
31 | 1f | 37 | 11111 | |
32 | 20 | 40 | 100000 | |
! | 33 | 21 | 41 | 100001 |
" | 34 | 22 | 42 | 100010 |
# | 35 | 23 | 43 | 100011 |
$ | 36 | 24 | 44 | 100100 |
% | 37 | 25 | 45 | 100101 |
& | 38 | 26 | 46 | 100110 |
' | 39 | 27 | 47 | 100111 |
( | 40 | 28 | 50 | 101000 |
) | 41 | 29 | 51 | 101001 |
* | 42 | 2a | 52 | 101010 |
+ | 43 | 2b | 53 | 101011 |
, | 44 | 2c | 54 | 101100 |
- | 45 | 2d | 55 | 101101 |
. | 46 | 2e | 56 | 101110 |
/ | 47 | 2f | 57 | 101111 |
0 | 48 | 30 | 60 | 110000 |
1 | 49 | 31 | 61 | 110001 |
2 | 50 | 32 | 62 | 110010 |
3 | 51 | 33 | 63 | 110011 |
4 | 52 | 34 | 64 | 110100 |
5 | 53 | 35 | 65 | 110101 |
6 | 54 | 36 | 66 | 110110 |
7 | 55 | 37 | 67 | 110111 |
8 | 56 | 38 | 70 | 111000 |
9 | 57 | 39 | 71 | 111001 |
: | 58 | 3a | 72 | 111010 |
; | 59 | 3b | 73 | 111011 |
< | 60 | 3c | 74 | 111100 |
= | 61 | 3d | 75 | 111101 |
> | 62 | 3e | 76 | 111110 |
? | 63 | 3f | 77 | 111111 |
@ | 64 | 40 | 100 | 1000000 |
A | 65 | 41 | 101 | 1000001 |
B | 66 | 42 | 102 | 1000010 |
C | 67 | 43 | 103 | 1000011 |
D | 68 | 44 | 104 | 1000100 |
E | 69 | 45 | 105 | 1000101 |
F | 70 | 46 | 106 | 1000110 |
G | 71 | 47 | 107 | 1000111 |
H | 72 | 48 | 110 | 1001000 |
I | 73 | 49 | 111 | 1001001 |
J | 74 | 4a | 112 | 1001010 |
K | 75 | 4b | 113 | 1001011 |
L | 76 | 4c | 114 | 1001100 |
M | 77 | 4d | 115 | 1001101 |
N | 78 | 4e | 116 | 1001110 |
O | 79 | 4f | 117 | 1001111 |
P | 80 | 50 | 120 | 1010000 |
Q | 81 | 51 | 121 | 1010001 |
R | 82 | 52 | 122 | 1010010 |
S | 83 | 53 | 123 | 1010011 |
T | 84 | 54 | 124 | 1010100 |
U | 85 | 55 | 125 | 1010101 |
V | 86 | 56 | 126 | 1010110 |
W | 87 | 57 | 127 | 1010111 |
X | 88 | 58 | 130 | 1011000 |
Y | 89 | 59 | 131 | 1011001 |
Z | 90 | 5a | 132 | 1011010 |
[ | 91 | 5b | 133 | 1011011 |
\ | 92 | 5c | 134 | 1011100 |
] | 93 | 5d | 135 | 1011101 |
^ | 94 | 5e | 136 | 1011110 |
_ | 95 | 5f | 137 | 1011111 |
` | 96 | 60 | 140 | 1100000 |
a | 97 | 61 | 141 | 1100001 |
b | 98 | 62 | 142 | 1100010 |
c | 99 | 63 | 143 | 1100011 |
d | 100 | 64 | 144 | 1100100 |
e | 101 | 65 | 145 | 1100101 |
f | 102 | 66 | 146 | 1100110 |
g | 103 | 67 | 147 | 1100111 |
h | 104 | 68 | 150 | 1101000 |
i | 105 | 69 | 151 | 1101001 |
j | 106 | 6a | 152 | 1101010 |
k | 107 | 6b | 153 | 1101011 |
l | 108 | 6c | 154 | 1101100 |
m | 109 | 6d | 155 | 1101101 |
n | 110 | 6e | 156 | 1101110 |
o | 111 | 6f | 157 | 1101111 |
p | 112 | 70 | 160 | 1110000 |
q | 113 | 71 | 161 | 1110001 |
r | 114 | 72 | 162 | 1110010 |
s | 115 | 73 | 163 | 1110011 |
t | 116 | 74 | 164 | 1110100 |
u | 117 | 75 | 165 | 1110101 |
v | 118 | 76 | 166 | 1110110 |
w | 119 | 77 | 167 | 1110111 |
x | 120 | 78 | 170 | 1111000 |
y | 121 | 79 | 171 | 1111001 |
z | 122 | 7a | 172 | 1111010 |
{ | 123 | 7b | 173 | 1111011 |
| | 124 | 7c | 174 | 1111100 |
} | 125 | 7d | 175 | 1111101 |
~ | 126 | 7e | 176 | 1111110 |
| 127 | 7f | 177 | 1111111 |
| 128 | 80 | 200 | 10000000 |
| 129 | 81 | 201 | 10000001 |
| 130 | 82 | 202 | 10000010 |
| 131 | 83 | 203 | 10000011 |
| 132 | 84 | 204 | 10000100 |
133 | 85 | 205 | 10000101 | |
| 134 | 86 | 206 | 10000110 |
| 135 | 87 | 207 | 10000111 |
| 136 | 88 | 210 | 10001000 |
| 137 | 89 | 211 | 10001001 |
| 138 | 8a | 212 | 10001010 |
| 139 | 8b | 213 | 10001011 |
| 140 | 8c | 214 | 10001100 |
| 141 | 8d | 215 | 10001101 |
| 142 | 8e | 216 | 10001110 |
| 143 | 8f | 217 | 10001111 |
| 144 | 90 | 220 | 10010000 |
| 145 | 91 | 221 | 10010001 |
| 146 | 92 | 222 | 10010010 |
| 147 | 93 | 223 | 10010011 |
| 148 | 94 | 224 | 10010100 |
| 149 | 95 | 225 | 10010101 |
| 150 | 96 | 226 | 10010110 |
| 151 | 97 | 227 | 10010111 |
| 152 | 98 | 230 | 10011000 |
| 153 | 99 | 231 | 10011001 |
| 154 | 9a | 232 | 10011010 |
| 155 | 9b | 233 | 10011011 |
| 156 | 9c | 234 | 10011100 |
| 157 | 9d | 235 | 10011101 |
| 158 | 9e | 236 | 10011110 |
| 159 | 9f | 237 | 10011111 |
160 | a0 | 240 | 10100000 | |
¡ | 161 | a1 | 241 | 10100001 |
¢ | 162 | a2 | 242 | 10100010 |
£ | 163 | a3 | 243 | 10100011 |
¤ | 164 | a4 | 244 | 10100100 |
¥ | 165 | a5 | 245 | 10100101 |
¦ | 166 | a6 | 246 | 10100110 |
§ | 167 | a7 | 247 | 10100111 |
¨ | 168 | a8 | 250 | 10101000 |
© | 169 | a9 | 251 | 10101001 |
ª | 170 | aa | 252 | 10101010 |
« | 171 | ab | 253 | 10101011 |
¬ | 172 | ac | 254 | 10101100 |
| 173 | ad | 255 | 10101101 |
® | 174 | ae | 256 | 10101110 |
¯ | 175 | af | 257 | 10101111 |
° | 176 | b0 | 260 | 10110000 |
± | 177 | b1 | 261 | 10110001 |
² | 178 | b2 | 262 | 10110010 |
³ | 179 | b3 | 263 | 10110011 |
´ | 180 | b4 | 264 | 10110100 |
µ | 181 | b5 | 265 | 10110101 |
¶ | 182 | b6 | 266 | 10110110 |
· | 183 | b7 | 267 | 10110111 |
¸ | 184 | b8 | 270 | 10111000 |
¹ | 185 | b9 | 271 | 10111001 |
º | 186 | ba | 272 | 10111010 |
» | 187 | bb | 273 | 10111011 |
¼ | 188 | bc | 274 | 10111100 |
½ | 189 | bd | 275 | 10111101 |
¾ | 190 | be | 276 | 10111110 |
¿ | 191 | bf | 277 | 10111111 |
À | 192 | c0 | 300 | 11000000 |
Á | 193 | c1 | 301 | 11000001 |
 | 194 | c2 | 302 | 11000010 |
à | 195 | c3 | 303 | 11000011 |
Ä | 196 | c4 | 304 | 11000100 |
Å | 197 | c5 | 305 | 11000101 |
Æ | 198 | c6 | 306 | 11000110 |
Ç | 199 | c7 | 307 | 11000111 |
È | 200 | c8 | 310 | 11001000 |
É | 201 | c9 | 311 | 11001001 |
Ê | 202 | ca | 312 | 11001010 |
Ë | 203 | cb | 313 | 11001011 |
Ì | 204 | cc | 314 | 11001100 |
Í | 205 | cd | 315 | 11001101 |
Î | 206 | ce | 316 | 11001110 |
Ï | 207 | cf | 317 | 11001111 |
Ð | 208 | d0 | 320 | 11010000 |
Ñ | 209 | d1 | 321 | 11010001 |
Ò | 210 | d2 | 322 | 11010010 |
Ó | 211 | d3 | 323 | 11010011 |
Ô | 212 | d4 | 324 | 11010100 |
Õ | 213 | d5 | 325 | 11010101 |
Ö | 214 | d6 | 326 | 11010110 |
× | 215 | d7 | 327 | 11010111 |
Ø | 216 | d8 | 330 | 11011000 |
Ù | 217 | d9 | 331 | 11011001 |
Ú | 218 | da | 332 | 11011010 |
Û | 219 | db | 333 | 11011011 |
Ü | 220 | dc | 334 | 11011100 |
Ý | 221 | dd | 335 | 11011101 |
Þ | 222 | de | 336 | 11011110 |
ß | 223 | df | 337 | 11011111 |
à | 224 | e0 | 340 | 11100000 |
á | 225 | e1 | 341 | 11100001 |
â | 226 | e2 | 342 | 11100010 |
ã | 227 | e3 | 343 | 11100011 |
ä | 228 | e4 | 344 | 11100100 |
å | 229 | e5 | 345 | 11100101 |
æ | 230 | e6 | 346 | 11100110 |
ç | 231 | e7 | 347 | 11100111 |
è | 232 | e8 | 350 | 11101000 |
é | 233 | e9 | 351 | 11101001 |
ê | 234 | ea | 352 | 11101010 |
ë | 235 | eb | 353 | 11101011 |
ì | 236 | ec | 354 | 11101100 |
í | 237 | ed | 355 | 11101101 |
î | 238 | ee | 356 | 11101110 |
ï | 239 | ef | 357 | 11101111 |
ð | 240 | f0 | 360 | 11110000 |
ñ | 241 | f1 | 361 | 11110001 |
ò | 242 | f2 | 362 | 11110010 |
ó | 243 | f3 | 363 | 11110011 |
ô | 244 | f4 | 364 | 11110100 |
õ | 245 | f5 | 365 | 11110101 |
ö | 246 | f6 | 366 | 11110110 |
÷ | 247 | f7 | 367 | 11110111 |
ø | 248 | f8 | 370 | 11111000 |
ù | 249 | f9 | 371 | 11111001 |
ú | 250 | fa | 372 | 11111010 |
û | 251 | fb | 373 | 11111011 |
ü | 252 | fc | 374 | 11111100 |
ý | 253 | fd | 375 | 11111101 |
þ | 254 | fe | 376 | 11111110 |
ÿ | 255 | ff | 377 | 11111111 |