Numbers
Time-Based OTP Preview Generator
Used by developers, writers, and creators worldwide.
The time-based OTP preview generator produces realistic 6-digit and 8-digit one-time password codes for design mockups, component testing, and documentation. Building a 2FA flow means you need convincing sample codes long before real TOTP infrastructure is wired up. These randomly formatted codes match the output of Google Authenticator, Authy, and Microsoft Authenticator exactly. Choose 6 digits for the RFC 6238 standard used by most consumer apps, or switch to 8 digits for high-security contexts like banking portals and enterprise VPNs. Generate up to a full batch at once to cover multiple UI states — fresh codes, near-expired codes, and leading-zero edge cases — all in one click.
Loading usage…
Free forever — no account required
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Set the Digits selector to 6 for standard authenticator app codes or 8 for high-security system mockups.
- Enter the number of codes you need in the Count field, from a single sample up to a full batch for test data.
- Click Generate to produce the list of sample OTP codes in the output panel.
- Copy individual codes or the full list and paste them directly into your design tool, test fixture, or documentation.
Use Cases
- •Populating OTP input fields across multiple screen states in a Figma authentication flow
- •Testing leading-zero handling and auto-advance behavior in a React OTP input component
- •Filling 2FA screenshots for App Store and Google Play store listings
- •Providing sample codes in a developer portal documenting TOTP-protected API authentication
- •Seeding a demo environment with realistic 8-digit codes when real TOTP secrets are not configured
Tips
- →Generate a batch of 20+ codes and scan for ones starting with zero — use those first to test your input field's zero-padding handling.
- →When mocking an expired-code error screen, pick a code from an earlier generation run so it feels distinct from the 'current' code on screen.
- →For 8-digit mockups, group digits as '4838 2910' rather than a solid block — that mirrors how real high-security apps display them.
- →Pair generated codes with a visible 30-second countdown timer in your prototype to make authentication flows feel realistic during user testing.
- →If your design shows multiple failed attempts, use three different generated codes for the error states to avoid repeating the same number visually.
- →Switch between 6-digit and 8-digit outputs when documenting an API that supports both modes, so your examples reflect each configuration accurately.
FAQ
can I use these OTP codes to test my login form or 2FA component
Yes, for display and interaction testing. Paste the generated codes into your component to verify digit grouping, clipboard paste handling, and auto-advance between input boxes. For end-to-end tests that verify real authentication, you'll need a TOTP library like otplib or pyotp configured with a test secret — these codes are not cryptographically derived and will never pass actual 2FA verification.
difference between 6 digit and 8 digit OTP codes
Six-digit codes have 1,000,000 possible values and are the RFC 6238 default used by nearly every consumer app and website. Eight-digit codes expand that to 100,000,000 values, cutting brute-force risk significantly — which is why banking portals and government systems often require them. Check your product spec before choosing; if it doesn't explicitly call for 8 digits, 6 is the right default.
why do some OTP codes start with zero and how should my app handle them
TOTP codes are zero-padded to their full digit length, so a computed value of 42391 becomes 042391 on a 6-digit system. Your input field must store the code as a string, not an integer, or the leading zero is silently dropped and validation fails. Use this generator to produce codes that start with zero and run them through your input component to catch that edge case early.