使用方式
先完成一次順手的操作
- 直接點那排位元開關就能改值;1 = 亮起凸出,0 = 熄滅內凹。
- 用寬度按鈕切換 8 / 16 / 32 位元;按「取負」或 +1 看進位漣漪動畫與溢位指認。
- 切到「位移」模式同時看算術(>>)和邏輯(>>>)右移分岔;切到「位元運算」模式逐欄對齊 AND / OR / XOR / NOT。
點一排位元開關,無號、二補數、十六進位讀數同時翻動 — 位元沒變,變的是讀法。Flip a bit — watch unsigned, signed (two's complement), hex, and octal update at once.
位元列 A 的五種讀法Five readings of row A
位元本身沒有值,有值的是讀法。同一排 1111 1111,用無號讀法讀是 255;用二補數(有號)讀法讀是 −1。位元一個都沒動,換的是怎麼讀它。這個工具讓位元列成為唯一的真相來源:點下去就翻,底下所有讀法同時跟著更新。Bits have no intrinsic value — the interpretation does. The same pattern 1111 1111 reads as 255 in unsigned and −1 in two's complement (signed). Not a single bit changed; only the reading rule did. This tool makes the bit row the single source of truth: click a bit to flip it, and all four readouts update in the same visual beat.
「取負」操作演示二補數的 −x = ~x + 1 定義:先全部位元取反(~x),再從最低位加一,進位從右向左漣波直到遇見第一個 0 位元停下。工具把這兩拍分開演出:第一拍整排瞬間取反,第二拍一顆冷青火花沿位元列橫向推進。當操作使符號位元(最高位)意外翻轉,有號讀數突變正負,那一格會被框住指認出來。The "Negate" operation demonstrates the two's complement rule −x = ~x + 1: first invert all bits, then add 1 from the LSB, rippling carry leftward until it hits a 0. The tool plays this in two distinct beats: all bits invert at once, then a cyan carry spark travels the row bit by bit. If the carry flips the sign bit (MSB) unexpectedly — causing signed overflow — that cell is framed and highlighted.
32 位元模式的所有讀法一律以 BigInt 計算,完全繞開 JavaScript 位元運算子 32 位有號的限制(例如 1 << 31 在 JS 會是負數)。邏輯右移(>>>)在 8/16 位元模式下以無號遮罩手算,保持語意正確。術語對照:二補數、符號位元、最高位元(MSB)、算術右移(>>)、邏輯右移(>>>)、符號延伸、溢位、進位漣波。All 32-bit readouts use BigInt, bypassing JavaScript's 32-bit signed-integer trap (e.g. 1 << 31 becoming negative). Logical right shift (>>>) in 8/16-bit modes is computed via an unsigned mask. Glossary: two's complement, sign bit, MSB, arithmetic right shift (>>), logical right shift (>>>), sign extension, overflow, carry ripple.
快速導覽
把需要的說明放在工具下方,讓第一次使用與之後回來複用都更順。
英文搜尋: twos complement visualizer、bit flip toggle tool、signed vs unsigned binary、arithmetic vs logical shift、int8 overflow demo、sign extension binary
使用方式
常見情境
常見問題
位元本身沒有值,值來自讀法。無號讀法把八個 1 當純二進位=255;二補數(有號)讀法把最高位當符號位元,1111 1111 代表 −1。位元一個都沒變,換的是怎麼讀它。
二補數取負的定義就是逐位取反再加一。以 5(0000 0101)為例:取反得 1111 1010,最低位 +1 得 1111 1011,那正是 −5。工具把這兩拍(取反、進位 +1)演出來,讓 −x = ~x + 1 變成看得見的動作。
0111 1111 加 1 時進位一路往左推,撞進最高位(符號位元),結果 1000 0000。無號讀是 128,但有號讀法看到符號位元變 1,就成了 −128。工具會把翻掉符號的那一格框起來指認出來。
正數時兩者一樣;負數時分岔。算術右移補進符號位元(維持負號),邏輯右移補 0。以 1111 0000 右移 1 位為例:算術得 1111 1000(−8),邏輯得 0111 1000(120)。工具同時把兩列並排。
number-base-converter 是「換算」— 你給一個值,它換成各種進位。位元實驗台是「讀法與運算」— 位元本身是輸入,你點它、對它取負/位移/做位元運算,看同一排位元在不同讀法下同時如何變化。兩支互相內鏈。
Quick guide
Compact below-tool notes that help first-run users and repeated visitors move faster without changing the main interface.
Chinese search: 二補數 計算、位元 視覺化、int8 溢位、算術右移 邏輯右移 差別、符號位元 溢位、補數 取負 演示
How to use
Examples
FAQ
Bits have no inherent value — the reading rule does. Unsigned treats all eight 1s as pure binary = 255. Two's complement (signed) treats the MSB as a sign bit, making 1111 1111 equal −1. Not a single bit changed; only the interpretation did.
Two's complement defines negation as bitwise NOT then add 1. Take 5 (0000 0101): invert to get 1111 1010, add 1 to get 1111 1011, which is −5. The tool plays both beats — invert, then carry ripple — so −x = ~x + 1 becomes a visible action.
Adding 1 to 0111 1111 carries all the way into the sign bit, producing 1000 0000. Unsigned reads 128, but signed sees a 1 in the MSB and reads −128. The tool frames the flipped bit as the overflow culprit.
Identical for positive numbers; they diverge for negatives. Arithmetic shift fills the vacated high bits with the sign bit (preserving the sign); logical shift fills with 0s. Right-shifting 1111 0000 by 1: arithmetic → 1111 1000 (−8), logical → 0111 1000 (120). The tool shows both rows in parallel.
Number Base Converter is about conversion — give it a value, get it in different bases. Binary Bit Visualizer is about interpretation and operations — bits are the input, and you flip them, negate them, shift them, and run bitwise ops on them, watching all four readings update in the same instant.