Online Notepad

Free text editor with formatting, auto-save, and export options

Auto-Save Text Formatting Multi-Format Export Private (Local Only)
Text Formatting
Inter (Default)
Arial
Georgia
Monospace
12px 16px 24px
Note Info

Last saved: Just now

Created: Today

Characters: 0

Words: 0

Export Options

Export your note in different formats:

TXT File
Plain text (no formatting)
HTML File
With formatting preserved
PDF File
Print-friendly document
Note Editor

Welcome to Online Notepad!

 

This is a free, private text editor that works in your browser. Your notes are stored locally on your device and never sent to any server.

 

Features:

  • Text formatting (bold, italic, lists, etc.)
  • Auto-save to your browser's storage
  • Export to TXT, HTML, and PDF
  • Dark mode for comfortable night editing
  • Multiple note management

 

Start typing your notes here...

What Is This Online Notepad?

This free, browser-based online notepad lets you write and format notes with bold, italic, lists, alignment, and colors. Notes are auto-saved locally on your device—nothing is uploaded—so it’s fast and private. You can export your notes to TXT, HTML, or PDF at any time.

Useful for quick memos, outlines, blog drafts, and meeting minutes. Explore related writing tools: Word/Character Counter · Text Converter · Text Diff Tool.

How to Use (Step-by-Step)
  1. Type or paste text in the Note Editor on the right.
  2. Use Text Formatting buttons (bold, italic, lists, alignment) to style your note.
  3. Adjust Font Family, Font Size, and Text Color as needed.
  4. Click Save Note anytime (auto‑save also runs after a short pause).
  5. Manage multiple notes from My Notes (open, edit, or delete).
  6. Export via Export Note to TXT/HTML/PDF when you’re done.
  7. Toggle Dark Mode or Word Wrap for comfortable editing.
Tip: For long URLs or code snippets, wrapping is handled automatically; use Word Wrap if you prefer scrolling.

${escapeHtml(noteName.value)}


${noteContent} `; mimeType = 'text/html'; break; case 'pdf': // 使用jsPDF和html2canvas生成PDF generatePdf(); exportModal.classList.add('hidden'); return; default: alert('Unsupported format'); return; } // 创建并下载文件 const blob = new Blob([content], { type: mimeType }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); // 关闭导出模态框 exportModal.classList.add('hidden'); } // 生成PDF function generatePdf() { const { jsPDF } = window.jspdf; const doc = new jsPDF(); // 创建一个临时元素来渲染内容 const tempDiv = document.createElement('div'); tempDiv.style.position = 'absolute'; tempDiv.style.top = '-1000px'; tempDiv.style.left = '-1000px'; tempDiv.style.width = '800px'; tempDiv.innerHTML = `

${escapeHtml(noteName.value)}


${editor.innerHTML}
`; document.body.appendChild(tempDiv); // 使用html2canvas转换为图像 html2canvas(tempDiv, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/jpeg', 1.0); const imgWidth = 210; // A4宽度(mm) const pageHeight = 297; // A4高度(mm) const imgHeight = canvas.height * imgWidth / canvas.width; let heightLeft = imgHeight; doc.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight); heightLeft -= pageHeight; // 处理多页 while (heightLeft > 0) { doc.addPage(); doc.addImage(imgData, 'JPEG', 0, -heightLeft, imgWidth, imgHeight); heightLeft -= pageHeight; } doc.save(`${noteName.value.replace(/\s+/g, '_')}.pdf`); document.body.removeChild(tempDiv); }); } // 切换深色模式 function toggleDarkMode() { darkMode = !darkMode; const editorContainer = editor.parentElement; if (darkMode) { editor.style.backgroundColor = '#1F2937'; editor.style.color = '#F9FAFB'; editorContainer.style.backgroundColor = '#1F2937'; toggleModeBtn.innerHTML = ' Light Mode'; } else { editor.style.backgroundColor = 'transparent'; editor.style.color = textColorPicker.value; editorContainer.style.backgroundColor = 'transparent'; toggleModeBtn.innerHTML = ' Dark Mode'; } } // 切换自动换行 function toggleWordWrap() { wordWrap = !wordWrap; if (wordWrap) { editor.style.whiteSpace = 'normal'; toggleWrapBtn.innerHTML = ' Word Wrap'; } else { editor.style.whiteSpace = 'nowrap'; toggleWrapBtn.innerHTML = ' No Wrap'; } } // 格式化相对时间 function formatRelativeTime(timestamp) { const now = new Date(); const past = new Date(timestamp); const diffMs = now - past; const diffMins = Math.floor(diffMs / 60000); const diffHours = Math.floor(diffMins / 60); const diffDays = Math.floor(diffHours / 24); if (diffMins < 1) return 'Just now'; if (diffMins < 60) return `${diffMins} minute${diffMins !== 1 ? 's' : ''} ago`; if (diffHours < 24) return `${diffHours} hour${diffHours !== 1 ? 's' : ''} ago`; if (diffDays < 7) return `${diffDays} day${diffDays !== 1 ? 's' : ''} ago`; return formatDate(past); } // HTML转义函数 function escapeHtml(text) { if (!text) return ''; return text .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); }