Bookmarklet Button
Create, test, and manage JavaScript bookmarklet buttons. Minify code, generate drag-to-toolbar links, and export collections.
About
A bookmarklet is a browser bookmark that stores a javascript: URI instead of a page URL. When clicked, it executes arbitrary JavaScript against the current page's DOM. The character limit varies by browser: Chrome handles roughly 2083 characters in the address bar, while Firefox tolerates significantly more. Exceeding these limits silently truncates your code, producing cryptic failures. This tool validates syntax via Function constructor parsing, minifies whitespace, wraps output in the javascript:void pattern to prevent page navigation, and generates a draggable anchor element ready for your bookmarks bar. It does not execute your code. Treat bookmarklets as unsigned scripts: they bypass Content Security Policy on some browsers and inherit the page's origin, so audit every snippet before deployment.
Formulas
The bookmarklet URI is constructed by wrapping user code in a void-returning IIFE to prevent the browser from navigating away from the current page:
Minification applies a pipeline of transformations to reduce character count:
Character count after encoding is critical. The final URI length L is calculated as:
Where encodedCode is the URI-encoded IIFE string. Syntax validation uses the Function constructor to parse without executing: new Function(code). A thrown SyntaxError indicates invalid JavaScript. This does not catch runtime errors or validate DOM API usage.
Reference Data
| Browser | Max URI Length | javascript: Support | CSP Blocks Bookmarklets | Drag-to-Bar Support | Notes |
|---|---|---|---|---|---|
| Chrome (v120+) | 2083 chars (address bar) | Yes | Sometimes (strict CSP) | Yes | Omnibox truncation risk |
| Firefox (v121+) | 65536+ chars | Yes | Rarely | Yes | Most permissive |
| Safari (v17+) | 80000+ chars | Yes | Sometimes | Yes | Must allow in preferences |
| Edge (Chromium) | 2083 chars | Yes | Sometimes | Yes | Same engine as Chrome |
| Brave | 2083 chars | Yes | Often (Shields) | Yes | Shields may interfere |
| Opera | 2083 chars | Yes | Sometimes | Yes | Chromium-based |
| Vivaldi | 2083 chars | Yes | Sometimes | Yes | Chromium-based |
| Arc | 2083 chars | Yes | Sometimes | Limited | Sidebar bookmark workflow |
| Tor Browser | 65536+ chars | Disabled by default | Yes (strict) | No | Security policy blocks most |
| IE 11 (Legacy) | 508 chars | Yes | No CSP support | Yes | Extremely limited length |
| Samsung Internet | ~2048 chars | Partial | Sometimes | No (mobile) | Mobile-only browser |
| iOS Safari | 80000+ chars | Yes (manual paste) | Sometimes | No drag (touch) | Add via share sheet workaround |