JavaScript Minifier

JavaScript Minifier

Minify JavaScript with Terser without executing it. Choose script or ES module mode, variable mangling and compression. A separate Worker supports cancellation and a 10-second timeout.

Input and results are processed in browser memory; this tool does not upload or store them. Reloading clears them. Site-wide advertising and analytics may operate separately, but tool usage events do not contain your input or output.

Comments & questions

JavaScript Minifier

Parse JavaScript source to remove unnecessary spacing and simplify code. Terser runs in a separate Web Worker that can be cancelled and stops after 10 seconds. Defaults are ordinary script mode, compression enabled and variable mangling disabled. Input code is not executed.

Key features

  • Select ordinary script or ES module mode
  • Control compression and variable mangling separately
  • Configure function and class names and license-style comments to be retained
  • Cancel the Worker or let the 10-second limit stop long tasks

How to use

  1. Paste JavaScript and choose ordinary script or ES module mode.
  2. Choose variable mangling and compression settings. Review externally referenced names before enabling mangling.
  3. Run the task; cancel or reduce input if processing takes too long.
  4. Copy the result and test it in the intended runtime before using it.

Use cases

  • Reduce the size of a small standalone JavaScript file
  • Compare script and module compression results
  • Evaluate output with and without local variable mangling

Frequently asked questions

Is input code executed or uploaded?

Input is parsed and printed as JavaScript syntax in a browser Worker. It is not executed with eval or function calls and is not sent to a server for this tool’s processing.

Should I choose script or module mode?

Select module for ES modules containing import or export. Module mode assumes strict mode and module scope; do not apply it blindly to an ordinary script that depends on global side effects.

Does variable mangling rename everything?

When enabled, Terser can shorten permitted local variable names. Property mangling and aggressive eval handling are disabled; function and class names are configured to be retained. Test code that uses external references or dynamic access.

Are comments and source maps preserved?

Terser’s license-style comments, such as @license, @preserve and /*!, are configured to be retained. Other comments may be removed, and no source map is generated. Check required legal notices against the original source.

Does this handle TypeScript, JSX or legacy browser transpilation?

This is a JavaScript minifier. TypeScript and JSX are not supported. It does not transpile syntax for older browsers or provide obfuscation that protects secrets.

What happens when I cancel or hit the timeout?

The Worker is terminated and no partial output is shown. Input is limited to 100,000 UTF-16 code units and execution to 10 seconds. Reduce input or disable compression before retrying.

Privacy

Input and results are processed in browser memory; this tool does not upload or store them. Reloading clears them. Site-wide advertising and analytics may operate separately, but tool usage events do not contain your input or output.

References

Related Tools

CSS MinifierHTML FormatterJS & SQL String EscapeWasm Module InspectorHreflang Matrix CheckerAST Query PlaygroundContainer Build GraphDependency Graph ExplorerSemver Range LabCron Schedule AuditorPatch Review WorkbenchSource Map ExplorerLocalization Catalog AuditorStructured Data ReviewerHTTP Archive AnalyzerWebhook Signature LabProtobuf Schema WorkbenchGraphQL Schema LabAvro Schema EvolutionLocal SQL WorkbenchSchema Form BuilderMesh Repair WorkbenchPipe Network LabRobot Arm Kinematics LabThermal Network LabBeam Response LabGear Train DesignerTolerance Stackup LabSensor Calibration FitPCB Stackup PlannerDigital Filter DesignerNetwork Reachability MapSun Shadow MapGPS Error SimulatorDigital Logic SimulatorAnalog Circuit LabMechanism Linkage LabAnalysis Mesh GeneratorOpenAPI Contract InspectorDatabase Migration PlannerDimensional Equation CheckerTruss Force LabBoolean Minimization LabControl Response LabQueueing Simulation LabGeofence Event SimulatorCoordinate Reference LabSurvey Traverse LabRaster Classification LabChoropleth Design LabMap Print ComposerRaster Reprojection LabElevation Contour MakerTerrain Viewshed LabWatershed DelineatorMap Tile PackagerText File Encoding WorkbenchFilesystem Portability AuditorSBOM License ExplorerFile Signature Auditornpm Lockfile Conflict ResolverSource Secret AuditorOffline Web Package BuilderCertificate Chain InspectorTorrent Metainfo InspectorChunked File PackagerEncrypted File VaultDuplicate File FinderArchive WorkbenchDesign Token ManagerSpacing Token DesignerResponsive Type SystemPackaging Dieline DesignerSVG Icon Sprite PackerFlex Layout PlaygroundCSS Grid PlaygroundRegex Equivalence LabMarkdown Repository AuditorLog Template MinerResponsive Layout AuditorEmail Template PreviewInternal Link GraphState Machine TesterPetri Net SimulatorGit History VisualizerCurl Request WorkbenchBinary Protocol DesignerHex File EditorBinary Patch WorkbenchFile Signature WorkbenchAPI Mock SandboxSchema Column MapperEvent Log SessionizerER Diagram DesignerTime Series Gap AuditorStratified Data SplitterData Lineage DesignerDecision Tree LabData Anonymization WorkbenchData Expectation RunnerJSON Schema ValidatorBasket Pattern AnalyzerRobots Policy TesterSEO HTML AuditorAccessibility Structure AuditorSyndication Feed WorkbenchIndexNow Payload BuilderCrawl Log AnalyzerCSP Policy WorkbenchSearch Performance AnalyzerCSV Formula Risk AuditorCORS Response SimulatorCache Header LabCookie Policy InspectorWeb Vitals Trace LabSitemap Health AuditorBatch File RenamerFile Manifest VerifierFolder Space MapFolder Difference ReviewerRoute Order OptimizerGeoJSON Map EditorPolygon Overlay LabCartographic Label PlacerSpatial Table JoinGeoJSON Topology AuditorGPX Track AnalyzerTrack Privacy RedactorCSV Table JoinCSV Pivot WorkbenchScientific Data ProfilerTabular Cleaning WorkbenchRecord ReconciliationData Dictionary BuilderCanonical Graph AuditorRedirect Plan TesterHTTP response and ping reference testBrowser and System InformationJSON ↔ YAML ConverterXML ↔ JSON ConverterMock Data Generator.gitignore GeneratorLicense GeneratorUser-Agent ParserPassword Strength CheckerCode to ImageXML FormatterHTTP Status Code LookupMIME Type LookupCSS Box Shadow GeneratorCSS Gradient GeneratorIndent ConverterNumber Base ConverterUnicode Escape ConverterUnicode InspectorJSON Structure DiffMarkdown Table GeneratorBase64 EncoderJSON FormatterURL EncoderSQL FormatterCron Expression GeneratorRegex TesterUUID GeneratorHash GeneratorTimestamp ConverterJWT DecoderHTML Entity ConverterMarkdown PreviewMeta Tag GeneratorJSON ↔ CSVCase ConverterImage to Base64
Explore all Dev Tools tools →Image/Media →Text/Convert →Life/Fun →