BCD to Binary Converter

A BCD (Binary-Coded Decimal) to binary converter translates sequential decimal keypad inputs (like pressing 1, then 2, then 3) into a single true binary number (123) that an arithmetic logic unit can process. Instead of building a massive dedicated multiplier, this design loops the output of a fast 8-bit vertical carry-cancel adder back into its own inputs shifted up by one bit (×2) and three bits (×8) to multiply the stored total by 10 each time a new digit is entered.

Redstone ComputingAdvancedJava Edition
BCD to Binary Converter video tutorial

Video: Redstone Calculator Tutorial Part 3 - BCD to Binary by mattbatwings

How to build it

  1. Build an 8-Bit Vertical Carry-Cancel Adder

    Construct an 8-bit vertical carry-cancel adder with bit 1 at the bottom and bit 128 at the top. Place a redstone lamp on each of the 8 vertical outputs so you can easily read the binary value while debugging.

  2. Add the Repeater Lock Tower

    Place a repeater coming out of each of the 8 output lamps. Run a vertical slab tower alongside the repeaters leading into side-facing repeaters so all 8 outputs are locked by default and hold their current state.

  3. Wire the ×2 and ×8 Bit-Shift Loop (Top Bit)

    Starting at the 5th bit from the bottom (the highest bit that can be shifted without overflowing 8 bits), pull the signal after the locked repeater and split it into two upward staircases with repeaters: one connecting to the adder input 1 bit higher (bit 6) and the other connecting to the input 3 bits higher (bit 8).

  4. Stack the Bit-Shift Modules Downward

    Replicate the two-branch upward shift wiring for the 4th, 3rd, 2nd, and 1st bits underneath. Each bit's locked output will now feed back into the adder at N+1 (×2) and N+3 (×8), automatically multiplying the stored value by 10.

  5. Create the 1, 2, 4, 8 BCD Input Bus

    Bring four parallel input lines (labeled 8, 4, 2, and 1) plus a common signal trigger line down to the bottom of the adder. Add repeaters on the input lines so the incoming keypad digit reaches the adder cleanly.

  6. Connect BCD Lines 1, 2, and 4

    Route the '1', '2', and '4' BCD input lines directly into the free inputs on the 1st, 2nd, and 4th bit layers of the vertical adder using solid blocks and redstone dust.

  7. Wire the BCD 8 Line via Carry-In

    Because both inputs on the 4th layer (value 8) are already occupied by the ×2 and ×8 feedback lines from lower bits, split the '8' BCD line using slabs so it simultaneously powers the 4, 2, 1, and bottom Carry-In (1) inputs (4 + 2 + 1 + 1 = 8).

  8. Build the Pulse Generator for the Latch

    Connect the common keypad signal line to a sticky piston holding a solid block with 2-tick repeaters to create a short monostable pulse. Route this pulse to temporarily depower the vertical lock tower, allowing the newly added sum to overwrite the old stored value.

  9. Install the Instant Clear Pistons

    Place 5 sticky pistons facing the lower output lamps (the bits connected to the feedback loop) and power them via a slab tower connected to the lock torch so they stay extended holding the lamps in place. Wiring a Clear button to depower both the lock line and these pistons will retract the lamps, breaking the feedback loop so the stored number clears immediately instead of slowly cycling out.

  10. Duplicate for Numbers A and B

    For a full calculator, build or WorldEdit-copy a second identical BCD-to-binary unit. Split the BCD input bus so it runs to both machines, and link both clear lines to your master Clear button.

How it works

Converting decimal digits entered one at a time (e.g., pressing 1, then 2, then 3) into a single binary number uses the formula (Current_Total × 10) + New_Digit:

  • Synchronous Addition: The core of the converter is an 8-bit vertical Carry-Cancel Adder, which computes any 8-bit sum in a constant 4 redstone ticks.
  • Multiplying by 10 via Bit Shifting: In binary, shifting a number up by 1 position multiplies it by 2, and shifting it up by 3 positions multiplies it by 8. Since (N × 2) + (N × 8) = N × 10, routing each output bit back into the adder inputs at bit + 1 and bit + 3 multiplies the stored value by 10 without needing a separate multiplier circuit.
  • 8-Input Carry Workaround: Bit 4 (value 8) receives feedback from both Bit 1 (shifted up 3) and Bit 3 (shifted up 1), leaving no open input for the BCD 8 line. The circuit solves this by feeding the 8 input into the free 4, 2, 1, and Carry-In (1) lines simultaneously.
  • Piston Loop Break: Merely unlocking the repeaters to clear the register takes a long time because the feedback loop keeps adding the decaying signal to itself. Retracting the output lamps with sticky pistons physically severs the feedback loop while the lock is released, zeroing the register in a single pulse.

Tips & variations

  • 8-Bit Limit (255 Max): Because the converter is 8 bits tall, the maximum value it can hold is 11111111 in binary, or 255. Entering a number higher than 255 will overflow the top bit.
  • Use Lamps for Debugging: Keep redstone lamps at the output of every adder layer and along the feedback lines. Since lamps act as solid opaque blocks when powered by repeaters, they let you visually verify the stored total and the ×10 predicted value at a glance.
  • WorldEdit Pasting Tip: If you use //copy and //paste -a to stack the diagonal bit-shift staircases, double-check the redstone dust after pasting, as overlapping air blocks can occasionally pop off dust or repeaters.

Frequently asked questions

Why does the BCD to Binary converter multiply by 10 on every button press?
When typing a multi-digit number from left to right (like 123), each new digit shifts the previous digits into a higher decimal place (1 becomes 10, then 12 becomes 120). Multiplying the current total by 10 and adding the newly pressed digit builds the full binary number dynamically.
How do you multiply by 10 in binary without a multiplier?
You shift the binary bits up by 1 position (which multiplies by 2) and by 3 positions (which multiplies by 8), then feed both shifted values into an adder. Adding 2x and 8x gives 10x.
What is the maximum number this 8-bit converter can store?
An 8-bit binary register can hold a maximum value of 255 (when all eight bits—1, 2, 4, 8, 16, 32, 64, and 128—are turned on).

Components used

More decoder / encoder