Search for a tool
Binary Coded Decimal (BCD)

Tool to code/decode in BCD (binary coded decimal) any integer number into 4-bit, especially in electronics.

Results

Binary Coded Decimal (BCD) -

Tag(s) : Electronics

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Binary Coded Decimal (BCD)' tool for free! Thank you!

Binary Coded Decimal (BCD)

BCD Decoder/Converter

 



DBC Encoder/Converter

 







Answers to Questions (FAQ)

What is BCD encoding? (Definition)

The BCD code (for binary coded decimal) is an encoding system used in electronics and computing to store integer numbers (decimal) by encoding their digits over 4-bit (0 or 1).

How to encrypt using BCD coding?

BCD (binary coded decimal) encoding replaces directly digits 0, 1, 2, …, 9 by their binary values (with 4 bits)

00000
10001
20010
30011
40100
50101
60110
70111
81000
91001

Example: To code 123, replace 1 by 0001, 2 by 0010 and 3 by 0011, so 123 is coded 0001 0010 0011 in BCD

In computers, most storage is done on 8 bits, and to store BCD 4 bits on 1 byte (8 bits) is done by filling with 0 or 1 (recommended) at the beginning (storage called extended BCD, used in particular by EBCDIC)

Example: The storage of 123 in extended BCD is 11110001 11110010 11110011 (completed with 1111 at the start of the byte)

In order not to lose space, there is the packed BCD which stores 2 4-bit digits on an 8-bit byte. In addition, the condensed BCD uses the 6 unused remaining 4-bit combinations (A, B, C, D, E, F in hexadecimal) to encode the signs + and -

+1010A
-1011B
+1100C
-1101D
+ 1110 E
unsigned 1111 F

Example: The storage of 123 in packed BCD is 00010010 00111100 (completed with + 1100 at the end if the number of digits is odd)

There are several ways to code + and - because several variants of BCD have been proposed by computer manufacturers like IBM or Burroughs.

How to decrypt BCD coding?

BCD conversion replaces each 4-bit group (packed BCD, the most common encoding) by its corresponding digit

Example: 0001 0010 0011 is decoded 1,2,3

If the code is extended BCD, the first 4 binary bits of each byte can be ignored.

What is the difference between BCD and binary?

The BCD code is identical to the binary code for the coding of the digits between 0 and 9. Beyond that, when it comes to encoding numbers, they differ.

Example: 10 is coded 00010000 in BCD and 00001010 in binary.

How to recognize an BCD ciphertext?

The message has a length multiple of 4.

The groups 1010, 1011, 1100, 1101, 1110 are in the minority and 1111 almost non-existent (except extended BCD).

How to write a negative number?

Some systems uses 1100 for + and 1101 for -

Example: -5 is then written 1101 0101

How to write a non-integer number?

There are different approaches to write/convert a non-integer (floating point) number.

The most common method is to use fixed point numbers where the point position is fixed a priori.

Example: It is decided that numbers are stored with 2decimal places (2 digits after the decimal point), then a BCD value 123 will then be read 1.23

Another method is used on some systems that use one of the non-digit values (such as 1100, 1101 or 1110) to store the position of the point.

What is the purpose of BCD?

BCD is often used in electronics, for storing or displaying numeric values. Conversion is easy, does not need a processor and is similar to peripherals such as 7-segment displays.

Another example is the storing of Dates in a BIOS of a motherboard, still today in BCD.

Also the DECIMAL format of the fields of certain databases can use this BCD coding.

What are BCD values non used in decimal representations?

Unused values are 1010, 1011, 1100, 1101, 1110, 1111

When was BCD invented?

The first uses of the BCD date from a period between 1950 and 1960

Source code

dCode retains ownership of the "Binary Coded Decimal (BCD)" source code. Except explicit open source licence (indicated Creative Commons / free), the "Binary Coded Decimal (BCD)" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Binary Coded Decimal (BCD)" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Binary Coded Decimal (BCD)" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

Cita dCode

The copy-paste of the page "Binary Coded Decimal (BCD)" or any of its results, is allowed (even for commercial purposes) as long as you cite dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Binary Coded Decimal (BCD) on dCode.fr [online website], retrieved on 2024-04-18, https://www.dcode.fr/binary-coded-decimal

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Binary Coded Decimal (BCD)' tool for free! Thank you!


https://www.dcode.fr/binary-coded-decimal
© 2024 dCode — El 'kit de herramientas' definitivo para resolver todos los juegos/acertijos/geocaching/CTF.
 
Feedback