JS Import Sorter — Free Online Tool

Sort and group ES module import statements alphabetically, separating external packages from internal relative imports. JS Import Sorter is a free online tool from the ToolsRift JavaScript Tools collection. It runs entirely in your browser — nothing to install, no signup, and your data never leaves your device.

Loading JS Import Sorter

How to use JS Import Sorter

Paste a file that begins with import statements, then click Sort & Group Imports. External packages are grouped first, then internal/relative imports, each sorted A–Z.

Frequently asked questions

How are imports grouped?

Imports are split into two groups: node builtins and external packages first, then internal/relative imports (./, ../, @/), with a blank line separating the groups.

Are side-effect imports reordered?

Side-effect imports like import './styles.css' are preserved in their original order and kept together, since their execution order can matter.

Is the rest of my file changed?

No. Only the leading block of import statements is reordered. Everything below the imports is preserved exactly as written.

More JavaScript Tools

JavaScript Obfuscator
Basic JavaScript obfuscation with variable renaming and string encoding to protect code
ES6 to ES5 Converter
Convert modern ES6+ arrow functions and syntax to ES5-compatible JavaScript for legacy browsers
JS to TypeScript
Add TypeScript type annotations to JavaScript functions for better type safety and IDE support
Regex Tester
Real-time regular expression tester with match highlighting, groups, and detailed match information
JS Console Simulator
Simulate JavaScript console.log output for code snippets and preview execution results
CommonJS ⇄ ESM Converter
Convert CommonJS require and module.exports to ES module import/export syntax and back for the common static patterns

← View all JavaScript Tools