Why You Should Never Store Passwords in the Browser (and What to Do Instead)

5 min read By Simple Tech Path

The short answer

Never save a customer’s password in the browser’s local storage, and never build a real login that works only in the browser. Anyone who opens the browser’s developer tools can read what is stored there, and the business owner has no safe copy of it. A real login needs a server that stores passwords as secure hashes and checks them there, or a trusted sign-in service.

I am writing this because it is easy to build a login screen that looks finished. Browser-only account demos are useful for showing a flow, but they must stay demos.

What a browser-only login does

A typical demo works like this:

  1. The visitor fills in a sign-up form with a name, an email and a password.
  2. The page saves those values in local storage.
  3. When the visitor logs in, the page compares what they typed with what it saved.

It feels like a real account. But there is no server involved, and that is exactly what makes it unsafe.

What is wrong with it

The password is readable. Local storage is not hidden. A visitor can open the developer tools, look at the stored values and see the password, as plain text if that is how it was saved.

Anyone can fake being logged in. Because the “check” happens in the visitor’s own browser, they can change the stored data and become any user, including an administrator.

The owner cannot help. If a customer forgets a password or asks to delete their account, there is nothing on the owner’s side. The data exists only on the customer’s device.

Data is lost easily. Clearing the browser, changing devices or using a private window all remove the account.

It teaches a bad habit. People reuse passwords. If someone types a real password into a demo that stores it in plain text, that password is exposed.

A browser-only demo keeps everything in the visitor's browser, while a real system checks and protects data on a server

What a real login does differently

In a real system:

  • the password goes to a server over a secure connection,
  • the server stores only a hash, a one-way scramble made with a slow, well-tested algorithm, never the password itself,
  • login happens on the server, which then gives the browser a session that expires,
  • the owner can reset or delete accounts,
  • rules such as limiting repeated wrong attempts are applied on the server.

Writing all of that yourself is easy to get wrong. Mistakes can expose every customer at once.

Safer options

  1. Use a sign-in service. Established providers handle passwords, resets and sessions, so you do not store passwords yourself. Check their prices and terms for your use.
  2. Use “sign in with” options from large providers, when your customers are comfortable with that.
  3. Avoid accounts altogether. Many small businesses do not need them. A booking form that asks for a name and a phone number, or a WhatsApp link, can be enough.
  4. If you build it yourself, use a mature framework and have someone with security experience review it.

How I label demos

When I build a demo that includes an account screen, I put a clear note on it saying that it is a demonstration, that nothing is sent to a server and that no real password should be entered.

A quick check before you trust any login

  • Can the owner see the list of users from their own computer?
  • Where are passwords stored, and in what form?
  • What happens if the customer clears their browser data?
  • Who looks after security updates in the future?

If you cannot answer these, treat the login as a demo.

See for yourself what a browser stores

You can check what any website keeps in your browser in under a minute. Open a page, press F12 to open the developer tools and find the tab called Application in Chrome or Edge, or Storage in Firefox. Open Local Storage and select the site. Every value that the page saved appears in a table, and you can edit or delete any of it.

Do this on a demo that saves accounts in the browser and you will see why it cannot be trusted: the data is in front of you, and you can change it. A real system keeps secrets where the visitor cannot reach them.

What to tell a customer or an owner

If a demo has a sign-up screen, say so plainly:

  • This screen is a demonstration of how the flow would look.
  • Nothing you type is sent anywhere.
  • Do not enter a real password.

Being clear about it protects the person using the demo, and it protects you from promising something the demo cannot deliver.

Frequently asked questions

Is it okay to use local storage for anything? Yes, for harmless preferences, such as a theme or a remembered tab. It is not for passwords or private data.

Can I hash the password in the browser and store it? That does not fix the main problem: the check is still done in the visitor’s browser, and anyone can change it.

Do I need a login for a small business site? Often no. Ask what problem it solves before building it.

Can AI write a secure login? It can help with code, but security needs testing and a person who is responsible. Do not rely on generated code alone.

#astro

How I Built a Blog with Astro and Claude Code

How I built a fast static blog with the free Astro template, Claude Code and a GitHub build check, plus the draft-post bug I found along the way.

5 min read