Online Notepad: how it works and how to build one
A simple notepad that saves in your browser. This guide explains what happens behind the button and shows the code, so you can build your own.
What it does
Write notes that are saved automatically in your browser, with several notes, word count, find, and download as .txt or .md. Nothing is sent to a server, so it works offline.
When to use it
- Quick notes and to-do lists
- Drafting text before pasting it elsewhere
- A scratchpad that survives a page reload
How to use it
- Start typing; it saves as you go.
- Add notes or switch between them.
- Download a note as a file.
Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/online-notepad
How it works
Notes are kept in an array in React state and saved to localStorage (a small key–value store in the browser) a moment after you stop typing. On load, the saved JSON is read back.
Because localStorage is per browser and per site, notes never leave your device, and they work offline.
Build it yourself
Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any React project.
useLocalNotes.ts (tsx)
import { useEffect, useState } from "react";
export function useLocalState<T>(key: string, initial: T) {
const [value, setValue] = useState<T>(initial);
useEffect(() => {
try { const saved = localStorage.getItem(key); if (saved) setValue(JSON.parse(saved)); } catch {}
}, [key]);
useEffect(() => {
const t = setTimeout(() => { try { localStorage.setItem(key, JSON.stringify(value)); } catch {} }, 400);
return () => clearTimeout(t); // save 400 ms after the last change
}, [key, value]);
return [value, setValue] as const;
}
Make it production-ready
- Sync across devices with an account and a database.
- Add Markdown preview.
Questions
Where are my notes saved?
In this browser’s local storage. Clearing browser data deletes them, so download anything important.
Free, runs in your browser, nothing is uploaded.