Bookmarklet Compiler


Raw JavaScript
0 chars in 0 chars out % smaller
Compiled Bookmarklet
Drag me to Bookmarks or right-click → Bookmark this link

Dragging to the bookmarks bar is a desktop-only feature. On mobile, tap Copy above, then manually create a new bookmark in your browser and paste the compiled code as the URL.

How to Use

  1. Paste your raw JavaScript into the left pane.
  2. The compiled bookmarklet appears on the right instantly.
  3. Drag the Drag me to Bookmarks button onto your browser's bookmarks bar, or right-click it and choose Bookmark this link.
  4. Navigate to any webpage and click the bookmark to run your script.

On mobile, dragging to the bookmarks bar is not supported — see the note below the output pane for the manual installation steps.

On mobile, dragging to the bookmarks bar is not supported. To install a bookmarklet:

  1. Paste your raw JavaScript into the input above.
  2. Tap Copy to copy the compiled bookmarklet.
  3. Create a new bookmark in your browser (bookmark any page first).
  4. Edit that bookmark and replace its URL with the copied code.
What Is a Bookmarklet?

A bookmarklet is a browser bookmark whose URL begins with javascript: instead of http://. When clicked, the browser executes the embedded JavaScript on the current page — no browser extension or installation required. Common uses include toggling dark mode, extracting data from tables, tweaking page styles, or automating repetitive tasks.

The Compilation Pipeline

Your code passes through a strict, sequential pipeline:

  1. IIFE Wrapper — The code is wrapped in (function(){ … })() so local variables don't leak into the target page's global scope.
  2. Minification via Terser — The industry-standard Terser library handles comment stripping, whitespace removal, dead-code elimination, and constant folding. It uses a full JavaScript parser so edge cases like regex literals, template literals, and semicolon-free style are all handled correctly.
  3. URI Encoding — Characters that would break a URL bar (%, ", ', #, &, <, >, `) are percent-encoded so the browser doesn't mangle your script before it executes.
Privacy

All compilation runs entirely in your browser — your code never leaves your device.