数値基数変換
二進法、八進法、十進法、十六進法の間で数を変換します。
結果はタイプすると更新されます。
この計算機の情報
A number base converter rewrites an integer from one positional base to another — binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). It reads your value in the source base, works out its plain decimal value, and re-expresses that value in the target base.
Each base uses a fixed set of digits: 0–1 for binary, 0–7 for octal, 0–9 for decimal and 0–9 then A–F for hexadecimal, where A–F stand for 10–15. Because 16 is 2⁴, each hex digit maps to exactly four binary digits, which is why programmers use hex as shorthand for raw bytes.
Worked example: the decimal number 255 is 11111111 in binary and FF in hexadecimal, since 255 = 15×16 + 15. The converter also reports the intermediate decimal value so you can check the working. A results table shows the same number in all four bases at once, and an invalid digit for the chosen source base is flagged rather than silently miscounted.
よくある質問
どうやって十進法から二進法に変換しますか?
Repeatedly divide by 2 and read the remainders from bottom to top. For example 10 in decimal is 1010 in binary, and 255 is 11111111.
十六進法は何に使われますか。
十六進法は 4 つの二進ビットを 1 桁に詰め込みます (0-9 次に A-F) それゆえにバイトを書くのに コンパクトな方法です。十進数 255 は 16 進法で FF です。
なぜ私の番号はダッシュを示していますか。
数字はソースベースに対して有効でなければなりません。例えば、二進法では 0 と 1 のみ、ヘクサデシマルでは 0-9 と A-F のみです。無効な数字は結果を定義しません。
十六進法での文字AからFは何を意味しますか。
これらは10から15までの値に対して一桁の数字であり、Aは10、Bは11、Fは15である。これにより、基数16は15までの数字を一つの場所に収める。
なぜ16進数の数字は2進数の数字と同じである?
Because 16 equals 2 to the fourth power, every hexadecimal digit covers exactly four bits. So the byte 11111111 groups into 1111 1111, which is FF — this number base converter does that grouping for you.
このコンバータは非常に大きな数を扱えるのですか。
これは整数に対して動作し、正確に整数を記憶できる範囲まで正確です(約9クワドリリオン、または2⁵³)。 それ以上の長さの二進法または十六進法文字列は最後の数字で精度を失う可能性があります。
API — コードからこの計算機を使う
この計算機を自由な JSON エンドポイントとして呼び出します。鍵は必要ありません。下のフィールド値をクエリパラメータまたは JSON として送信してください。 省略したものは、このページに既に入力されているデフォルトと同じ値を使用します。未知のパラメータは 400 で、サイレンスゼロはありません。 API ドキュメントを読む →
エンドポイント
GET https://calculator.free/api/v1/number-base/
curl
curl "https://calculator.free/api/v1/number-base/?amount=255&from=10&to=2"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/number-base/?" + new URLSearchParams({
"amount": "255",
"from": "10",
"to": "2"
}));
const data = await r.json();
console.log(data.results);
結果は一般的な指導のための推定であり,財務的,医療的または税務的な助言ではない。