Generate words, sentences, and paragraphs of lorem ipsum placeholder text.
Version 3 supports modern JavaScript runtimes, including Node.js, Bun, Deno,
modern browsers, and React Native. It has no runtime dependencies and ships ESM,
CommonJS, a browser build, CLI, and TypeScript declaration files.
Version Notes
This README is for version 3.
Version 3 is tested with Node.js 22+, Bun 1.3+, and Deno 2+.
What's New in Version 3
Version 3 keeps the public API compatible with version 2 while modernizing the
package around current JavaScript runtimes.
No runtime or development package dependencies.
Vanilla JavaScript source with hand-written TypeScript declarations.
ESM and CommonJS builds for package consumers.
Browser builds for UNPKG and jsDelivr.
Bun-powered local development, testing, building, and publishing.
The new v3 package is small:
ESM: 5.4 kB raw, 1.7 kB gzip
CommonJS: 6.7 kB raw, 2.2 kB gzip
Browser: 5.9 kB raw, 1.8 kB gzip
Browser minified: 3.2 kB raw, 1.4 kB gzip
npm package: about 8.6 kB packed
For older documentation:
Version 2: see the 2-stable branch
Version 1: see the 1-stable branch
If you need compatibility with older versions of Node.js, use lorem-ipsum@2,
which supports Node.js 8 and later.
For truly ancient runtimes, lorem-ipsum@1.0.6 supports Node.js as far back as
0.4.
Installation
npm i lorem-ipsumbun add lorem-ipsumdeno install npm:lorem-ipsum
Note for Deno Users
Deno users can import the package from npm with an npm: specifier.
The library API works in Deno. The CLI can also run under Deno, though commands
that read package metadata or copy to the clipboard may need Deno permissions.
Note for Browser Users
Browsers can load the package directly from UNPKG.
loremIpsum() is a compatibility API for users who prefer the original
function-style interface.
import { loremIpsum } from "lorem-ipsum";// const { loremIpsum } = require("lorem-ipsum");loremIpsum(); // Generates one sentence.
You can pass options to customize the output.
import { loremIpsum } from "lorem-ipsum";loremIpsum({ count: 1, // Number of words, sentences, or paragraphs. format: "plain", // "plain" or "html". paragraphLowerBound: 3, // Minimum sentences per paragraph. paragraphUpperBound: 7, // Maximum sentences per paragraph. random: Math.random, // PRNG function. sentenceLowerBound: 5, // Minimum words per sentence. sentenceUpperBound: 15, // Maximum words per sentence. suffix: "\n", // Line ending for paragraphs. units: "sentences", // "words", "sentences", or "paragraphs". words: ["ad", "..."], // Word list to draw from.
Using the CLI
Install globally with npm or Bun to use the lorem-ipsum command.
If you install with Bun, make sure Bun's global bin directory is on your
PATH. You can find it with bun pm bin -g.
If you install with Deno, make sure Deno's global bin directory is on your
PATH. Deno installs global commands under $HOME/.deno/bin by default.
Use --force to replace an existing Deno install.