Free online negative number encoder. Just load your negative integers and they will automatically get encoded to binary. It supports one's complement, two's complement, excess binary, sign bit, and base -2 representations. There are no ads, popups or nonsense, just an awesome negative binary encoder. Load negative values – get encoded binaries. Created for developers by developers from team Browserling.
Free online negative number encoder. Just load your negative integers and they will automatically get encoded to binary. It supports one's complement, two's complement, excess binary, sign bit, and base -2 representations. There are no ads, popups or nonsense, just an awesome negative binary encoder. Load negative values – get encoded binaries. Created for developers by developers from team Browserling.
This tool converts negative decimal numbers (and also positive) to the binary numeral system. The binary number system has only two symbols '0' and '1', and unlike the decimal number system, there is no negative sign '-'. Therefore, negative numbers in binary are represented in special binary schemes that encode the minus sign to a bit pattern. We have implemented five different signed number representations. The first one is the signed bit method. It's the simplest way to encode a signed integer to binary. In this method, the most significant bit (leftmost bit) is used as the sign of the number. If the integer is positive, then the leftmost bit is set to '0'. If the number is negative, then the leftmost bit is set to '1'. You can think of '0' as '+' and '1' as '-'. The remaining bits show the absolute value of the number. For example, 01011101b is a positive number because the first bit is '0' and the remaining bits are 1011101b, which is equal to 93 in decimal, therefore this number is +93. A negative -93 would be 11011101b. As you can see, the first bit is flipped from 0 to 1 and that also flips the sign of the number. The second method of representation is one's complement. The positive numbers in this method are the same as in the sign bit method but the negative numbers are created by applying the bitwise not operation to positive numbers. This operation replaces all zeros with ones and all ones with zeros. For example, if we have the number 93, which is 01011101b in binary, then after bitwise not this number becomes 10100010b, which is negative -93. The third encoding method is two's complement. This method is the dominant encoding scheme in computer hardware as it's easier to perform mathematical operations with it. In two's complement, a negative number is add-one its bitwise not. What this means is first we flip all bits in the number and then increment the number by one. To get -93 from 93, which is 01011101b, we first find its bitwise-not, which is 10100010b, and then add one. The number becomes 10100011b, which is -93. Another representation method is biased binary, also known as excess (offset) binary code. It uses a novel approach to encode negatives. In excess code, the number (-2)n is defined to be 0b and it can represent numbers from (-2)n to 2n-1. The number (-2)n+1 is 1b, (-2)n+2 is 10b, (-2)n+3 is 11b, and so on (you're counting up from (-2)n). If you want to find -93, then you first find the smallest n, such that this number fits in (-2)n. In this case, it's 7 because (-2)7 is -128. Then you define (-2)7 to be 00000000b, and now you count up: -128 is 00000000b, -127 is 00000001b, -126 is 00000010b, -125 is 00000011b, …, until you reach -93. In this case, -93 is 00100011b. If you keep counting up, you'll also find 93, which is 11011101b, and 127, which will be all one-bits 11111111b. Yet another encoding method is base minus two, also known as the negabinary method, which decomposes a number into a sum of powers of -2. For example, the number -94 is the sum 1×(-2)⁷ + 1×(-2)⁶ + 1×(-2)⁵ + 0×(-2)⁴ + 0×(-2)³ + 1×(-2)² + 1×(-2)¹ + 0×(-2)⁰ and from the coefficients before the -2 powers we find that -94 is 11100110b. In the same way, the number 94 is 1×(-2)⁸ + 1×(-2)⁷ + 0×(-2)⁶ + 1×(-2)⁵ + 0×(-2)⁴ + 0×(-2)³ + 0×(-2)² + 1×(-2)¹ + 0×(-2)⁰, which is 110100010b in base -2. The last method is a bonus method as it doesn't change the binary value in any way and only adds a minus '-' sign before negative binaries. We named it the human method because it makes it easy to distinguish between positive and negative binary numbers. This utility also allows you to customize the binary number format – you can add padding of any length and append a binary prefix or suffix to the output number. Simple and easy!
This tool converts negative decimal numbers (and also positive) to the binary numeral system. The binary number system has only two symbols '0' and '1', and unlike the decimal number system, there is no negative sign '-'. Therefore, negative numbers in binary are represented in special binary schemes that encode the minus sign to a bit pattern. We have implemented five different signed number representations. The first one is the signed bit method. It's the simplest way to encode a signed integer to binary. In this method, the most significant bit (leftmost bit) is used as the sign of the number. If the integer is positive, then the leftmost bit is set to '0'. If the number is negative, then the leftmost bit is set to '1'. You can think of '0' as '+' and '1' as '-'. The remaining bits show the absolute value of the number. For example, 01011101b is a positive number because the first bit is '0' and the remaining bits are 1011101b, which is equal to 93 in decimal, therefore this number is +93. A negative -93 would be 11011101b. As you can see, the first bit is flipped from 0 to 1 and that also flips the sign of the number. The second method of representation is one's complement. The positive numbers in this method are the same as in the sign bit method but the negative numbers are created by applying the bitwise not operation to positive numbers. This operation replaces all zeros with ones and all ones with zeros. For example, if we have the number 93, which is 01011101b in binary, then after bitwise not this number becomes 10100010b, which is negative -93. The third encoding method is two's complement. This method is the dominant encoding scheme in computer hardware as it's easier to perform mathematical operations with it. In two's complement, a negative number is add-one its bitwise not. What this means is first we flip all bits in the number and then increment the number by one. To get -93 from 93, which is 01011101b, we first find its bitwise-not, which is 10100010b, and then add one. The number becomes 10100011b, which is -93. Another representation method is biased binary, also known as excess (offset) binary code. It uses a novel approach to encode negatives. In excess code, the number (-2)n is defined to be 0b and it can represent numbers from (-2)n to 2n-1. The number (-2)n+1 is 1b, (-2)n+2 is 10b, (-2)n+3 is 11b, and so on (you're counting up from (-2)n). If you want to find -93, then you first find the smallest n, such that this number fits in (-2)n. In this case, it's 7 because (-2)7 is -128. Then you define (-2)7 to be 00000000b, and now you count up: -128 is 00000000b, -127 is 00000001b, -126 is 00000010b, -125 is 00000011b, …, until you reach -93. In this case, -93 is 00100011b. If you keep counting up, you'll also find 93, which is 11011101b, and 127, which will be all one-bits 11111111b. Yet another encoding method is base minus two, also known as the negabinary method, which decomposes a number into a sum of powers of -2. For example, the number -94 is the sum 1×(-2)⁷ + 1×(-2)⁶ + 1×(-2)⁵ + 0×(-2)⁴ + 0×(-2)³ + 1×(-2)² + 1×(-2)¹ + 0×(-2)⁰ and from the coefficients before the -2 powers we find that -94 is 11100110b. In the same way, the number 94 is 1×(-2)⁸ + 1×(-2)⁷ + 0×(-2)⁶ + 1×(-2)⁵ + 0×(-2)⁴ + 0×(-2)³ + 0×(-2)² + 1×(-2)¹ + 0×(-2)⁰, which is 110100010b in base -2. The last method is a bonus method as it doesn't change the binary value in any way and only adds a minus '-' sign before negative binaries. We named it the human method because it makes it easy to distinguish between positive and negative binary numbers. This utility also allows you to customize the binary number format – you can add padding of any length and append a binary prefix or suffix to the output number. Simple and easy!
This example converts ten negative integers into a binary representation using the two's complement algorithm. This algorithm finds the binary values of the corresponding positive integers, calculates their inverse (by complementing 1's and 0's), and adds +1 to the result. Applying this algorithm, for example, to the number -9, we get 9 = 1001b, inverted 0110b, add +1 = 0111b = -9.
This example applies the one's complement algorithm to four negative numbers. It first finds the binary code of positive numbers and then complements all bits. This example also uses padding and the algorithm also complements the padding bits. In this case, the padding is 8, so the first number -5 is converted to the positive number 5 as 101, then full padding is added as 00000101, and now, the digits are inverted – 1's become 0's and 0's become 1's. The resulting number 11111010 is the number -5 in one's complement scheme. The output is also formatted with the "0b" prefix that says that it's a binary base number.
In this example, we enter both positive and negative integers in the input. We run the sign bit algorithm and as you can see, signed and unsigned numbers have the same binary values with the exception of the first bit – in negative integers, the most significant bit is 1 but in positive integers, it's 0. This is why this encoding scheme is called the sign bit representation – the first bit always tells the number's sign and the remaining bits tell the magnitude of the number. We have also added the "B" postfix and set padding to eight positions. Note that the padding doesn't include the sign bit.
In this example, we convert three pairs of positive and negative numbers to the offset binary encoding. When encoding positive numbers, it finds the regular binary representation of the number and adds a 1 at the beginning, which indicates a plus sign. When encoding a negative number, this method acts a little bit differently. First, it converts the unsigned number to a binary base, then it calculates its inverse, then it increments the result by one (similar to two's complement method), and then it adds a 0 at the beginning, which indicates the minus sign.
This example converts two numbers (9 and -9) from a base 10 to a negative base -2. To convert a number to a new base, it's first decomposed as a sum of powers of the new base and then the coefficients before each power term represent the number in this new base. With the base -2, the number is decomposed into a sum of powers of -2 and for the decimal number 9, we have the following result: 9₁₀ = 1×(-2)⁴ + 1×(-2)³ + 0×(-2)² + 0×(-2)¹ + 1×(-2)⁰ = 11001₂. For the negative number -9, we have the following: -9₁₀ = 1×(-2)³ + 0×(-2)² + 1×(-2)¹ + 1×(-2)⁰ = 1011₂.
This example demonstrates the human method of representing negative binary numbers. We, humans, can simply add a - sign in front of the number, just like we do for regular decimal numbers, and that's what we do here. For example, the number 123 is 1111011 in binary and the number -123 is simply -1111011. We also add an uppercase binary prefix "0B" to the results so that everyone knew it was a binary number.
You can pass input to this tool via ?input query argument and it will automatically compute output. Here's how to type it in your browser's address bar. Click to try!
View and edit binary values in your browser.
Convert binary numbers to a binary file.
Create a binary dump of files in your browser.
Convert binary numbers to ternary numbers.
Convert ternary numbers to binary numbers.
Convert binary values to any base (up to base 64).
Convert binary numbers to Roman numerals.
Convert Roman numerals to binary values.
Find the sum of set bits in binary numbers.
Swap pairs of adjacent bits in a binary number.
Create a list of increasing of decreasing binary numbers.
Create a binary number with alternating bits.
Create a list of all binary choices of a specific length.
Calculate bitwise sheffer stroke operator of binary values.
Encode every binary bit as a binary coded decimal.
Decode binary coded decimals to binary bits.
Perform division operation on several binary numbers.
Rotate bits of a binary number to the right.
Rotate bits of a binary number to the left.
Extract n-th bit from a binary number.
Count parity of a binary number.
Convert EBCDIC characters to binary values.
Convert binary bits to EBCDIC symbols.
Change endianness of a binary number.
Convert a binary number from little endian to big endian.
Convert a binary number from big endian to little endian.
Find the binary representation of a floating point number.
Decode a binary number to a floating point number.
Convert any image to binary colors.
Convert a binary string to a bitmap image.
Convert a bitmap image to zeros and ones.
Replace each bit with two bits in each byte.
Group bits together to create bytes.
Expand bytes into individual bits.
Split a binary number into smaller binary numbers.
Join multiple smaller binary numbers into a single binary.
Extract a part of a binary number.
Substitute ones and zeros with any other values.
Add signed or unsigned padding to binary numbers.
Drop leading or trailing bits and make a binary value shorter.
Introduce random errors in binary values.
Print the same binary numbers in the same colors.
Use two different colors for binary zeros and ones.
See the difference between two binary blobs of bytes.
Create visualizations of and, or, xor, not binary ops.
Make binary bits go in a zigzag.
Make binary bits go in a spiral.
Make binary bits go in a circle.
Create a sqaure shape from binary bits.
Create a sequence of random binary bits.
Create a sequence of random binary nybbles.
Create a sequence of random binary octets.
Create a sequence of random binary words.
Create a sequence of random binary long words.
Create a look-and-say sequence in base-2.
Apply run length encoding algorithm on a binary sequence.
Decode a previously RLE-encoded binary sequence.
Spell a binary number in words.
Print statistics of the input binary values.
Subscribe to our updates. We'll let you know when we release new tools, features, and organize online workshops.
Enter your email here
We're Browserling — a friendly and fun cross-browser testing company powered by alien technology. At Browserling we love to make people's lives easier, so we created this collection of binary tools. Our tools have the simplest user interface that doesn't require advanced computer skills and they are used by millions of people every month. Our binary tools are actually powered by our programmer tools that we created over the last couple of years. Check them out!