Random String Generator

This tool creates random strings you can use as passwords, API keys, tokens or test data, generated using your browser's Web Crypto API so the output is cryptographically strong rather than predictable like a basic random number function. You set the string length from 1 to 256 characters, how many strings to generate at once (from 1 up to 50), and the character makeup, either through a preset such as alphanumeric, hex, numeric only or URL-safe, or by ticking your own combination of uppercase letters, lowercase letters, digits and symbols. You can also add extra custom characters or exclude ambiguous ones such as 0, O, 1, l and I so strings are easier to read and type correctly. Once generated, the calculator shows the entropy in bits, the alphabet size used, the number of possible combinations as a power of ten, and a strength rating running from weak through to excellent, along with a full breakdown of length, quantity, character set and generation method. Use the strength bar as your guide: aim for at least 72 bits for a general password and 128 bits or more for API keys, tokens or anything security-sensitive. Everything runs locally in your browser and nothing is sent to any server, but for production secrets and long-term cryptographic keys, generate them in a secure server-side environment rather than relying on browser output alone.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner: Premium Homes
Cryptographically Strong  Uses Web Crypto API (window.crypto.getRandomValues). No data sent to any server.

1. String Options

2. Character Sets

Generated Strings

Entropy
-
Bits per string
Alphabet Size
-
Unique characters
Possible Combinations
-
10^x combinations
Strength
-
Result
Click Generate to create strings.

String Details

Length-
Quantity-
Character set-
Alphabet size-
Entropy per string-
Generation method-

Strength Reference

Weak (below 40 bits)Not recommended
Fair (40-71 bits)Short-term / low risk
Good (72-111 bits)Suitable for passwords
Strong (112-127 bits)API keys, tokens
Excellent (128+ bits)Cryptographic use

How the Random String Generator Works

This tool uses window.crypto.getRandomValues(), the Web Crypto API built into modern browsers. This is a cryptographically strong pseudo-random number generator (CSPRNG) that produces unpredictable output suitable for security-sensitive use cases such as passwords, API keys, and session tokens. It falls back to Math.random() only if the Web Crypto API is unavailable, which is noted in the output.

The algorithm works as follows: given a character alphabet of size N and a desired string length L, it generates L random integers in the range [0, N) using rejection sampling (to avoid modulo bias) and maps each to a character in the alphabet. The entropy of each string is L x log2(N) bits.

Entropy and Why It Matters

Entropy is a measure of unpredictability, expressed in bits. Higher entropy means more possible combinations, which makes brute-force guessing harder. The formula is:

Entropy = length x log2(alphabet size)

Use CaseRecommended EntropyExample Settings
General password72+ bitsLength 12, all chars (94-char set)
High-security password100+ bitsLength 16, all chars
API key / token128+ bitsLength 22, alphanumeric (62-char set)
Session token128+ bitsLength 32, hex (16-char set)
Cryptographic key256 bitsLength 44, alphanumeric or length 64, hex

Character Sets Explained

The generator supports these character groups:

The exclude field lets you remove ambiguous characters (such as 0, O, 1, l, I) that can be misread when printed or typed manually.

Worked Example

Default settings: length 24, alphanumeric preset (A-Z, a-z, 0-9 = 62 characters), 1 string.

A string of this type with 142.9 bits of entropy would take longer than the age of the universe to brute-force on current hardware.

Related Calculators

Method: String entropy calculated as L x log2(N) where L = string length and N = alphabet size. Random values generated using window.crypto.getRandomValues() with rejection sampling to eliminate modulo bias. Strength thresholds based on NIST SP 800-63B guidance and general security practice.

This tool generates strings in your browser only. No strings are transmitted to any server. For production security use, always generate cryptographic secrets in a secure server-side environment using a trusted library. Do not use browser-generated strings as long-term cryptographic keys without additional key derivation.

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-07-19 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.