Numbers
Random Number in Any Base Generator
Used by developers, writers, and creators worldwide.
The random number in any base generator produces values in binary, octal, decimal, hex, base32, base36, or any base from 2 to 36 — with control over digit length and letter casing. Set the digit count to 8 and you get consistently padded output, which matters when populating fixed-width fields or building test vectors. Developers reach for this when testing number-conversion functions, seeding systems that require a specific radix, or generating mock memory addresses without manual conversion. Security and auth work often needs exact-length hex or base32 strings — TOTP secrets, API key stubs, hashing test vectors. The uppercase toggle ensures output matches the convention your library or spec expects, whether that's lowercase CSS hex or uppercase assembly constants.
Loading usage…
Free forever — no account required
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Set the 'Count' field to how many random numbers you want generated at once.
- Select your target base from the dropdown — choose a preset like binary or hex, or type any base from 2 to 36.
- Enter the exact number of digits each output value should have in the 'Digits' field.
- Toggle 'Uppercase' to yes or no depending on the casing convention your project requires.
- Click Generate, then copy individual values or select all output to paste into your editor or document.
Use Cases
- •Generating 8-digit uppercase hex mock addresses for debugger and memory-inspection walkthroughs
- •Creating fixed-length base32 TOTP secret stubs to test RFC 6238 auth flows in Postman
- •Producing batches of binary strings for bitwise-operation exercises in CS coursework
- •Building octal permission mask examples for Linux chmod tutorials and documentation
- •Prototyping base36 short IDs for URL shorteners or order-number systems before wiring a real PRNG
Tips
- →For 32-bit memory address simulation, use base 16 with 8 digits and uppercase — that matches standard debugger notation.
- →Base32 TOTP secrets are typically 16 or 32 characters; set digits accordingly and keep uppercase on for RFC 6238 compatibility.
- →Generate a large batch (count 50+) of binary strings at 8 digits each to build realistic test suites for bit-manipulation functions.
- →Base36 with 6–8 digits produces short IDs with extremely low collision probability — useful for prototyping slug or token systems.
- →For number-systems coursework, generate the same count in base 2, base 8, and base 16 side by side to compare representations of the same magnitude range.
- →If your parser expects zero-padded fixed-width input, always set the digits field explicitly rather than relying on the default to avoid off-by-one test failures.
FAQ
how do I generate random hex numbers of an exact length
Set the base to 16 (hex) and enter your required digit count in the digits field — the generator pads shorter values with leading zeros so every output string is the same width. Toggle uppercase or lowercase to match your target format, then copy the batch directly into your code or test fixture.
is base32 or base64 better for TOTP secrets
Base32 is the standard for TOTP (RFC 6238) because it uses only uppercase letters and digits 2–7, making it case-insensitive and safe in environments where lowercase is ambiguous. Base64 is more compact but includes characters that break in URLs and case-insensitive systems, so base32 is the safer choice for auth secrets.
are the random numbers from this tool cryptographically secure
No — the generator uses JavaScript's Math.random(), which is fine for testing, education, and prototyping but is not a CSPRNG. Don't use this output as actual cryptographic keys or production tokens. For security-critical entropy, use the Web Crypto API (crypto.getRandomValues()) instead.