Random String Generator
カスタム文字セットから安全なランダム文字列・トークンをブラウザ内で一括生成します。
入力した文字をそのまま候補として使用します。重複文字は出現確率を高めます。
How to Use the Random String Generator
Enter exactly the characters you want to use, or build the editable set with the quick-setting buttons. Choose a length from 1 to 256, set a quantity from 1 to 100, and optionally exclude characters that are easy to confuse. Generate creates each string with a separate crypto.getRandomValues() call. Copy one result, copy the newline-separated batch, or download a text file.
Why Custom Character Sets and Bulk Output Matter
Random strings are not limited to account passwords. A hex-only set can match an existing token format; an unambiguous uppercase set suits printed coupon codes; and a URL-safe set avoids escaping in routes. Bulk generation helps seed fixture data, prepare one-time IDs, and test import pipelines.
For account credentials, continue to use the Password Generator, which provides password-specific choices and strength feedback. This tool focuses on custom formats and multiple non-password outputs.
ランダム文字列ジェネレーターの使い方
文字セット欄へ使用したい文字を直接入力するか、クイック設定で大文字・小文字・数字・記号・Hexを追加または削除します。長さ(1〜256)と個数(1〜100)を指定して生成してください。結果は個別コピー、改行区切りの全件コピー、または.txtで保存できます。紛らわしい文字の除外は生成時だけ適用され、入力欄の内容は失われません。
カスタム文字セット・一括生成が有用な場面
- テスト用APIキー -- 本番形式に合わせたダミー値をまとめて用意
- クーポンコード --
ABCDEFGHJKLMNPQRSTUVWXYZ23456789で誤読しにくいコードを生成 - 一時ID・フィクスチャ -- URLやデータベースの制約に合わせて一括生成
よくある落とし穴と対処 / Common Pitfalls
| 落とし穴 / Pitfall | 問題 / Problem | 対処 / Fix |
|---|---|---|
| Math.random()で自作 Using Math.random() | 予測可能でトークン用途に不適 Predictable for secure tokens | Web Crypto APIを使う Use crypto.getRandomValues |
| 0/O、1/l/Iを混在 Ambiguous characters | 印刷・口頭で誤読される Easy to misread | 除外トグルを有効化 Enable exclusion |
| 複数環境で使い回す Reusing values | 漏洩や衝突の影響が広がる Expands impact | 用途ごとに独立生成 Generate per use |
| 文字セットを絞りすぎる Narrow charset | 候補数が減る Fewer possibilities | 長さを増やす Add length |
| URL・シェル不向きの記号 Unsafe symbols | エスケープ問題が起きる Escaping bugs | 用途に安全な文字だけを使う Use a safe set |
言語別コード例 / Code Examples
JavaScript (Web Crypto)
const charset = "0123456789abcdef";
const values = new Uint32Array(24);
crypto.getRandomValues(values);
const token = Array.from(values, (v) => charset[v % charset.length]).join("");Python (secrets)
import secrets
charset = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"
codes = ["".join(secrets.choice(charset) for _ in range(12)) for _ in range(10)]Node.js (crypto.randomBytes)
const { randomBytes } = require("node:crypto");
const charset = "0123456789abcdef";
const token = Array.from(randomBytes(24), (v) => charset[v % charset.length]).join("");Shell (openssl rand)
openssl rand -hex 16
openssl rand -base64 24生成例 / Before & After
Before: charset=0123456789abcdef, length=16, quantity=3
After:
9f31a5c082e4d7b6
06bd79e12a83fc45
c48e0271bd96a53f
Before: charset=ABCDEFGHJKLMNPQRSTUVWXYZ23456789, length=10, quantity=3
After:
X7M2KQ9W4Z
BH6T3NP8RY
Q4V9G2K7MCWhy browser-only?
Tokens and IDs may grant access, identify private records, or become fixtures copied into sensitive systems. A server-side generator could expose them to network paths, memory, or logs. This tool generates, displays, copies, and exports every string inside your browser. Nothing is transmitted or stored. Watch the DevTools Network tab while generating: the operation creates zero requests.
トークンやIDはアクセス権限や非公開データに結びつく場合があります。本ツールは生成・表示・コピー・ファイル作成の全てがブラウザ内で完結し、生成結果を外部へ送信・保存しません。
Frequently Asked Questions / よくある質問
How is this different from the Password Generator? / Password Generatorとの違いは何ですか?
For account passwords, we still recommend the Password Generator. This tool is for non-password uses such as test API-key values, coupon codes, temporary IDs, and fixture data, especially when you need a custom character set or bulk output.
Is this cryptographically secure? / 暗号学的に安全ですか?
Yes. It uses crypto.getRandomValues with Uint32Array, the same Web Crypto API approach used by other security-oriented tools on this site. Each output is generated with a separate call.
Can I generate multiple strings at once? / 一度に複数生成できますか?
Yes. Set the quantity from 1 to 100, then copy strings individually, copy all as newline-separated text, or download a .txt file.
Are generated strings sent to a server? / 生成結果は外部送信されますか?
No. Generation, display, copying, and text-file creation all happen locally in your browser. Tokens and IDs are not sent to or stored by a server.
What are useful custom charset examples? / カスタム文字セットの活用例は?
Use 0123456789abcdef for hex-style tokens, ABCDEFGHJKLMNPQRSTUVWXYZ23456789 for coupon codes without confusing characters, or letters, digits, hyphen, and underscore for URL-safe IDs.
What does excluding ambiguous characters remove? / 紛らわしい文字の除外とは?
It removes 0, O, o, 1, l, and I at generation time. The editable charset remains unchanged, so turning the option off restores those characters.
関連ツール / Related Tools
開発をもっと効率的に
PR
レンタルサーバー
エックスサーバー
国内シェアNo.1の高速レンタルサーバー(エックスサーバー社調べ)。WordPressも簡単セットアップ。
詳しく見る →レンタルサーバー
ConoHa WING
国内最速クラスのレンタルサーバー。独自ドメイン永久無料特典付き(特典内容は変更される場合があります)。
詳しく見る →レンタルサーバー
mixhost
高速SSD・HTTP/3対応のクラウド型レンタルサーバー。
詳しく見る →VPS
シンVPS
メモリ単価が国内最安水準・オールNVMe SSD搭載の高性能VPS(大容量メモリプラン利用時)。開発・検証環境の構築に。
詳しく見る →Windows VPS
ConoHa for Windows Server
Windows環境のVPS。リモートデスクトップで開発・検証環境を構築。
詳しく見る →