How to password-protect an HTML page, without code
Short answer: a password has to be checked somewhere the visitor can't see. A password written into the page's own JavaScript can be read with View Source, so it isn't one. You can encrypt the file in your browser with a free tool like StatiCrypt, or, simplest, upload the page to a host that checks the password on its server before it sends anything. With DocPin you drop in the .html file, choose Password, and send the link. No code, and the page itself never reaches anyone who doesn't know the password.
On this page
Try it: what does a snoop see?
Each tab locks the same page a different way. Try the password, then press View source to see what anyone could read without it.
Simplified examples. The "Checked by the host" screen is DocPin's real lock screen; the source shown is what a browser receives before the password is entered.
Three ways to put a password on a page
| Method | Is the page safe without the password? | Changing the password | Cost and effort |
|---|---|---|---|
| Password in the page's JavaScript | NoThe password and the page are both in the file | Edit the file | Free, a few lines of code |
| Encrypted file: StatiCrypt, PageCrypt | If the password is longAnyone can download the file and guess offline, as fast as their computer allows | Encrypt again and re-upload; old copies keep the old password | Free and open source; you still need somewhere to host it |
| Checked by the host: DocPin, Tiiny Host and others | YesThe page isn't sent until the password is right, and repeated guesses are slowed down | Type a new one; the link stays the same | A paid plan; no code |
StatiCrypt is a good tool, and honest about how it works: it encrypts your page with AES-256, stretching the password with 600,000 rounds of PBKDF2, and decrypts it in the visitor's browser. With a long, random password that's strong. The catch is that the encrypted page is public, so a short password like client2026 can be guessed without you ever knowing, and there's no way to lock out one person later without re-encrypting for everyone.
How to password-protect an HTML page with DocPin
- Upload the page. Sign in to DocPin, choose Add page → Upload a file, and drop your .html file, a folder, or a .zip with an
index.html. It gets a link likeacme.docpin.it/launch-plan. - Choose Password. Under who can open it, pick Password and type one with at least 8 characters. Passwords are part of Pro, $8 a month.
- Send the link and the password separately. Visitors see "This page is private. Enter the password to open it." The link works on any device.
- Change it whenever you like. A new password locks out everyone using the old one, and the link doesn't change. Upload a new version of the page and it appears behind the same link and password.
Made the page with Claude or ChatGPT? Skip the file: connect DocPin and say "publish this to DocPin with a password". See sharing a Claude artifact privately.
When a password isn't the right lock
A password can be forwarded. If the page is for particular people, a client's team say, limit it to their emails or their whole @company.com instead. They confirm their email with Google or an emailed link, a forwarded link doesn't let anyone else in, and you can see who opened it by name.
Hosts with passwords, compared
| Option | Password | Catch |
|---|---|---|
| DocPin | Pro$8 a month or $80 a year | Static pages only (HTML, CSS, JavaScript), up to 25 MB per upload. Free plan has no passwords |
| Tiiny Host | Solo$18 a month, or $13 a month billed yearly | Costs more for the same lock; handles PDFs, PHP and big files well |
| Shareable | Free | Free plan up to 25 pages and 5 MB per file; own domain on Pro, $7.50 a month |
| ShareDuo | Free | Free links expire after 1 hour, 1 day or 7 days; Plus is $4.99 a month |
| Stacktree | Free | Free pages last 7 days; Solo is $19 a month |
| StatiCrypt or PageCrypt | Free | Encrypted file anyone can download and try passwords on; you host it yourself |
| .htaccess on your own server | Free | Needs an Apache server you control, and the browser's plain sign-in box |
Prices in US dollars, from each tool's own pages: Tiiny Host on 8 November 2026, the others on 1 December 2026.
Questions people ask
How do I password-protect an HTML page?
Upload it to a host that checks passwords on its server. With DocPin, drop the .html file in, choose Password, and send the link. Visitors type the password to open it; the page isn't sent to anyone who doesn't know it.
Can I password-protect a page with just HTML or JavaScript?
Not safely. Anything in the page's HTML or JavaScript, including the password and the content it hides, can be read with View Source. Use an encryption tool like StatiCrypt, or a host that checks the password for you.
Is StatiCrypt secure?
With a long, random password, yes: it uses AES-256 with 600,000 rounds of PBKDF2. But the encrypted file is public, so anyone can download it and try passwords offline, with no lockout. Short or guessable passwords are the weak point.
Can I password-protect a GitHub Pages site?
GitHub Pages has no password setting, which is why people use StatiCrypt with it. To keep the page private without encrypting it, upload it to a host with passwords instead.
How do I password-protect a website for free?
StatiCrypt and PageCrypt are free if you already have hosting. Shareable, ShareDuo and Stacktree have free plans with passwords, with limits such as expiring links. DocPin's passwords are on Pro, $8 a month.
Will a password-protected page show up on Google?
Not on DocPin. Search engines only see the lock screen, which is marked not to be indexed, and link previews show "Private page" instead of your title.
Put a real password on your page
Drop in an .html file and choose who can open it. Free for 3 pages; passwords on Pro, $8 a month.
Start freeSources. Plans and features change, so check these for the latest:
- StatiCrypt: README and FAQ on GitHub
- PageCrypt: PageCrypt
- Tiiny Host: Pricing
- Shareable: Pricing
- ShareDuo: Home and pricing
- Stacktree: Pricing
- DocPin: Pricing, Access, How pages run