Home Tools Blog All Tools
🏠 Home 🔧 Tools 📝 Blog 👋 About 📬 Contact ⚡ All Free Tools
📝 Text Tools — Free & Instant

Free Lorem Ipsum Generator

Generate paragraphs, sentences or words of placeholder text instantly. Classic Lorem Ipsum, random Latin, HTML format, or start with the traditional opening line.

📄 Paragraphs 📝 Sentences 🔤 Words 💻 HTML Format 📋 List Format ⚡ Instant
⚙️ Generator Settings
0
Paragraphs
0
Sentences
0
Words
0
Characters
📤 Generated Text
0 chars 0 words
⚡ Quick Presets
`; break; case 'list_ul': output = ``; break; case 'list_ol': output = `
    \n${paragraphs.map(p => `
  1. ${p}
  2. `).join('\n')}\n
`; break; case 'markdown': output = `# Lorem Ipsum\n\n${paragraphs.join('\n\n')}`; break; case 'json': output = JSON.stringify(paragraphs, null, 2); break; default: output = paragraphs.join('\n\n'); } // Update output area const outputArea = document.getElementById('outputArea'); const isCode = ['html_p', 'html_full', 'list_ul', 'list_ol', 'json'].includes(format); outputArea.value = output; outputArea.classList.toggle('html-font', isCode); // Update stats const allText = paragraphs.join(' '); const wordArr = allText.trim().split(/\s+/).filter(Boolean); const sentArr = allText.match(/[^.!?]+[.!?]+/g) || []; document.getElementById('statParas').textContent = paragraphs.length; document.getElementById('statSents').textContent = sentArr.length; document.getElementById('statWords').textContent = wordArr.length; document.getElementById('statChars').textContent = allText.length; document.getElementById('outChars').textContent = output.length; document.getElementById('outWords2').textContent = wordArr.length; // Update preview if showing if (showingPreview) renderPreview(paragraphs, format); // Save to history saveHistory(amount, genType, vocabKey, paragraphs[0]); } function renderPreview(paragraphs, format) { const pb = document.getElementById('previewBox'); if (['html_p', 'html_full', 'list_ul', 'list_ol'].includes(format)) { pb.innerHTML = document.getElementById('outputArea').value; } else if (format === 'markdown') { pb.innerHTML = `

Lorem Ipsum

` + paragraphs.map(p => `

${p}

`).join(''); } else { pb.innerHTML = paragraphs.map(p => `

${p}

`).join(''); } } function togglePreview() { showingPreview = !showingPreview; const pb = document.getElementById('previewBox'); const btn = document.getElementById('previewBtn'); const oa = document.getElementById('outputArea'); if (showingPreview) { const output = oa.value; if (!output.trim()) { showingPreview = false; return; } const paras = output.split(/\n\n+/).filter(Boolean); renderPreview(paras, document.getElementById('format').value); pb.classList.add('show'); oa.style.display = 'none'; btn.textContent = '✏️ Raw'; } else { pb.classList.remove('show'); oa.style.display = ''; btn.textContent = '👁️ Preview'; } } // ========== PRESETS ========== function applyPreset(preset) { const presets = { blog: { type: 'paragraphs', amount: 5, vocab: 'lorem', format: 'html_p', classic: true, punct: true }, card: { type: 'sentences', amount: 2, vocab: 'lorem', format: 'plain', classic: true, punct: true }, title: { type: 'words', amount: 5, vocab: 'lorem', format: 'plain', classic: false, punct: false }, list: { type: 'sentences', amount: 8, vocab: 'random', format: 'list_ul', classic: false, punct: true }, email: { type: 'paragraphs', amount: 3, vocab: 'lorem', format: 'plain', classic: true, punct: true }, json: { type: 'sentences', amount: 10, vocab: 'lorem', format: 'json', classic: false, punct: true } }; const p = presets[preset]; if (!p) return; // Set type tab document.querySelectorAll('.type-tab').forEach(t => { t.classList.toggle('active', t.dataset.type === p.type); }); genType = p.type; document.getElementById('amount').value = p.amount; document.getElementById('vocab').value = p.vocab; document.getElementById('format').value = p.format; togState.startClassic = p.classic; togState.punctuation = p.punct; document.getElementById('togClassic').classList.toggle('active', p.classic); document.getElementById('togPunct').classList.toggle('active', p.punct); generate(); showToast('⚡ Preset applied!'); } // ========== HISTORY ========== function saveHistory(amount, type, vocab, preview) { genHistory.unshift({ amount, type, vocab, preview: preview?.substring(0, 60) + '…', time: new Date().toLocaleTimeString() }); genHistory = genHistory.slice(0, 6); renderHistory(); } function renderHistory() { const el = document.getElementById('histList'); if (genHistory.length === 0) { el.innerHTML = '
No history yet
'; return; } el.innerHTML = genHistory.map((h, i) => `
📄 ${h.amount} ${h.type} ${h.vocab} ${h.time}
${escapeHtml(h.preview) || '—'}
`).join(''); } function reloadHistory(i) { const item = genHistory[i]; if (item) { document.getElementById('amount').value = item.amount; document.getElementById('vocab').value = item.vocab; document.querySelectorAll('.type-tab').forEach(t => { t.classList.toggle('active', t.dataset.type === item.type); }); genType = item.type; generate(); showToast('🕐 History item loaded'); } } function escapeHtml(text) { const div = document.createElement('div'); div.textContent = text; return div.innerHTML; } // ========== ACTIONS ========== function copyOutput() { const val = document.getElementById('outputArea').value; if (!val.trim()) { showToast('⚠️ Generate text first', '#f59e0b'); return; } navigator.clipboard.writeText(val); showToast('📋 Copied to clipboard!'); } function downloadOutput() { const val = document.getElementById('outputArea').value; const fmt = document.getElementById('format').value; if (!val.trim()) { showToast('⚠️ Generate text first', '#f59e0b'); return; } const ext = ['html_p', 'html_full', 'list_ul', 'list_ol'].includes(fmt) ? '.html' : fmt === 'json' ? '.json' : fmt === 'markdown' ? '.md' : '.txt'; const blob = new Blob([val], { type: 'text/plain' }); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'lorem-ipsum' + ext; a.click(); URL.revokeObjectURL(a.href); showToast('💾 Downloaded!'); } function clearOutput() { document.getElementById('outputArea').value = ''; document.getElementById('previewBox').innerHTML = ''; document.getElementById('previewBox').classList.remove('show'); document.getElementById('outputArea').style.display = ''; document.getElementById('previewBtn').textContent = '👁️ Preview'; showingPreview = false; const ids = ['statParas', 'statSents', 'statWords', 'statChars', 'outChars', 'outWords2']; ids.forEach(id => document.getElementById(id).textContent = '0'); showToast('🗑️ Cleared'); } // ========== INITIALIZE ========== window.addEventListener('DOMContentLoaded', () => { generate(); });