Better Auth accepts passwords from 8 to 128 characters by default. You can change both limits in your auth settings. This guide changes the Better Auth password length rules with minPasswordLength, and shows a password that’s too short being refused.
The short answer: set minPasswordLength and maxPasswordLength inside emailAndPassword. Better Auth checks them on the server for every sign-up.
Syntax
emailAndPassword: {
enabled: true,
minPasswordLength: <number>,
maxPasswordLength: <number>,
},
minPasswordLength: the shortest password allowed. The default is 8.maxPasswordLength: the longest password allowed. The default is 128.
The reference: Configuration (opens in a new tab) in the Better Auth email and password documentation.
Prerequisites
- Better Auth with email and password sign-in switched on, and a sign-up form to try it with (Email & Password (opens in a new tab))
Step 1: Set a New Minimum
The example is a small bookshop app. Open your auth settings, lib/auth.ts, and add minPasswordLength:
import { betterAuth } from "better-auth";
import { Pool } from "pg";
export const auth = betterAuth({
database: new Pool({
connectionString: process.env.DATABASE_URL,
}),
emailAndPassword: {
enabled: true,
minPasswordLength: 12,
},
});
Save the file. The running app picks it up.
Step 2: Try a Short Password
Sign up with a password of 10 characters. The form’s own check still allows 8, so the password reaches Better Auth, which refuses it:

The Terminal running the app shows the refusal, with status 400:
2026-11-19T04:22:30.807Z WARN [Better Auth]: Password is too short
POST /api/auth/sign-up/email 400 in 14ms (next.js: 2.0ms, application-code: 12ms)
Give the form’s password field the same limit, minLength={12}, so the browser asks for 12 characters before anything is sent.
Step 3: Use a Long Enough Password
Sign up again with a password of 12 characters or more. This time the account is created and the new user is signed in:

Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Changing only the form’s minLength | Anyone calling Better Auth directly can still use a shorter password | Set minPasswordLength in the auth settings; the form is only a hint |
| Setting a minimum above the maximum | No password can pass | Keep minPasswordLength below maxPasswordLength |
FAQ
Do existing passwords stop working?
No. Signing in checks a password against its stored hash and only the maximum length, so existing users keep signing in. The new minimum applies whenever a password is set: at sign-up, and when it’s changed or reset.
Can I require numbers or symbols?
Not with these two options: they only set the length.
Conclusion
minPasswordLength and maxPasswordLength set the password rules on the server, where they can’t be skipped. Match the form’s minLength so people see the rule before they send the form.
Additional Resources
Related
- Better Auth Tutorial — Part 3: Sign Up and Sign In with Email and Password, where this is one step of the full setup
Better Auth, Next.js and other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with or endorsed by Better Auth, Inc. or Vercel.
0 comments