Skip to content

CommonJS ↔ ESM Online Free

New

Convert CommonJS require/module.exports snippets to ESM import/export and back (best-effort).

  • Processed in your browser
  • Privacy-first
  • No account required
  • Nothing uploaded by default

Examples

CommonJS to ESM

const fs = require("fs");
import fs from "fs";

How CommonJS ↔ ESM works

Convert CommonJS require/module.exports snippets to ESM import/export and back (best-effort). Runs locally in your browser.

  1. 1. Add input. Paste, type, or upload. Use a sample if you just want to see it work.
  2. 2. Run it. Processing happens in the browser.
  3. 3. Copy or download. Take the output and close the tab.
  • CommonJS to ESM
Does it handle every module pattern?
It covers common require/import and exports patterns. Dynamic or computed imports need manual review.

ToolBay does not store your input. Close the tab and it is gone. More developer tools.