About the Random Binary Generator
This tool makes random binary numbers: strings of 0s and 1s of the length you choose. Pick how many bits each number has, from a single bit up to 512, and how many numbers you want. Every bit is an independent fair coin flip from your browser's secure random generator, and leading zeros are kept, so an 8-bit result always shows eight digits. You can group the bits in fours or eights so long numbers are easier to read, put a 0b in front, and ask for no repeats. It is handy for teaching, for practising conversions, for test data and for puzzles. Nothing is sent anywhere.
Updated October 2026
How to use the Random Binary Generator
- 1Enter how many bits each number should have, from 1 to 512.
- 2Enter how many numbers you want, up to 1,000.
- 3Choose whether to group the bits in fours or in eights, and whether to add a 0b prefix.
- 4Tick No repeats if every number should be different.
- 5Press Generate, then copy the list or download it as a text file.
How binary numbers work
A binary number uses only the digits 0 and 1. Each position is worth double the one to its right, so the digits of 1011 stand for 8, 4, 2 and 1 in that order, which here adds up to 8 plus 2 plus 1, or 11.
An 8-bit number is one byte and can hold 0 to 255. A 16-bit number holds 0 to 65,535. The generator shows every position, including leading zeros, so you can see the full width.
When random binary is useful
- Practising binary to decimal and binary to hex conversion with fresh questions.
- Making test input for a program that reads bit strings or flags.
- Teaching how bits, nibbles and bytes relate.
- Creating random bit masks, subnet-style patterns or puzzle data.
- Checking how a display, parser or table copes with long bit strings.
Choosing length and grouping
Use 4 bits for a single hex digit, 8 bits for a byte, 16 or 32 bits for typical integer sizes and 128 or 256 bits when you want something that looks like a key or a hash. Grouping in eights makes the byte boundaries easy to see, and grouping in fours matches hex digits one to one.
Turn the 0b prefix on if the numbers will be pasted into code. Many languages, such as Python, JavaScript and C, read 0b1011 as binary.
Avoiding repeats
With short numbers, repeats are likely: only 16 different 4-bit numbers exist. Tick No repeats to get a list of different values. If you ask for more numbers than the length allows, the tool tells you the limit instead of looping.
Phone and computer
The options stack in one column on a phone. Long numbers scroll sideways inside the result box so the page itself never scrolls sideways. For other base values use the Random Hex Generator or Random Octal Generator, and the Binary Translator turns bits into text.
Features
- From 1 to 512 bits per number
- Up to 1,000 numbers per press
- Grouping in fours (nibbles) or eights (bytes), with a space between groups
- Optional 0b prefix
- No-repeats option, with a clear message when that is impossible
- Fair bits from the browser's secure random generator
Frequently asked questions
Are the bits really random?
They come from your browser's secure random generator, the same source used for passwords and keys, and every bit is an independent fair choice between 0 and 1. The tool does not use a seed, so the results cannot be repeated.
Why do the numbers start with zeros?
Because every position is chosen at random, about half of the numbers start with a 0. They are kept so that an 8-bit number always shows eight digits, as it would inside a computer.
What does grouping do?
It splits the digits into blocks of four or eight with a space between them, for example 1011 0010 instead of 10110010. It only changes how the number is shown. If the length is not a multiple of the group size, the first group is padded with zeros on the left.
How can I turn the result into decimal or hex?
Use our Number Base Converter or the Binary Calculator. Paste the digits without spaces for the easiest conversion.
How many different numbers exist for a given length?
An n-bit number has 2 to the power n possibilities: 256 for 8 bits, 65,536 for 16 bits and about 4.3 billion for 32 bits. If you ask for more numbers than that without repeats, the tool says so.
Can I use these as keys or passwords?
A long random binary string is unpredictable, but for secrets it is better to use a password manager or a key generator made for the job, because binary text is easy to mis-copy.
Is my data sent to a server?
No. The numbers are made in your browser and never leave your device.