Developer Tools
Bookmarklet Builder
Turn JavaScript into a working bookmarklet. Strips comments, minifies whitespace, wraps in an IIFE, URL-encodes, and gives a drag-to-install button.
Bookmarklet builder
JavaScript source
Paste the JavaScript body. The tool wraps it in an IIFE, strips comments, minifies whitespace, and URL-encodes the result into a ready-to-install bookmarklet.
Build options
Options apply each time you edit the source. The preview and install button update on the fly.
Install
Drag the button below onto your bookmarks bar to install it. You can also right-click the button and choose Bookmark this link. Show your bookmarks bar with Ctrl+Shift+B (or Cmd+Shift+B on macOS).
Click does nothing on this page. Drag this button to your bookmarks bar.
Encoded bookmarklet URL
Paste this exact string into a new bookmark's URL field if drag-to-install is not available.
javascript:(()%3D%3E%7Bconst text%3Ddocument.body.innerText%3Bconst words%3Dtext.trim().split(%2F%5Cs%2B%2F).filter(Boolean)%3Balert(words.length%2B%22 words on this page%22)%3B%7D)()%3Bvoid 0
Final JavaScript body
The wrapped, comment-stripped, and minified code that gets URL-encoded above. Handy for debugging.
(()=>{const text=document.body.innerText;const words=text.trim().split(/\s+/).filter(Boolean);alert(words.length+" words on this page");})();void 0Starter presets
Click any preset to load its code. Edit, rename, then drag to install. Every preset uses only built-in browser APIs.
What is a bookmarklet?
A bookmarklet is a regular browser bookmark whose URL starts with the javascript: scheme. When you click it, the browser executes the code in the context of the current page. It is the lightest possible way to extend the web without writing a browser extension, and works in Chrome, Edge, Firefox, Safari, and Brave on desktop. Mobile support is limited because most mobile browsers do not run javascript: bookmarks from the address bar; on iOS Safari, the standard workaround is to invoke the bookmark by typing part of its name in the address bar.
Safety notes
- Bookmarklets run with the same privileges as code on the page. They can read forms, cookies set on that origin, and the DOM. Do not install bookmarklets from sources you do not trust.
- Modern sites with a strict Content Security Policy can block inline scripts and may stop a bookmarklet from running. There is no universal workaround other than testing on the target page.
- The tool does not execute your code. Encoding happens locally in the browser, and the source you paste is never uploaded.
How to use
- Paste or write the JavaScript body in the editor. Skip the javascript: prefix; the tool adds it for you.
- Pick a wrap mode. IIFE is the safe default; choose Async IIFE if your code needs await; pick Raw if you really want the snippet untouched.
- Leave Strip comments and Minify whitespace on so a stray // does not collapse the entire bookmarklet into one line of comment.
- Drag the blue button onto your bookmarks bar (Ctrl+Shift+B on Windows or Linux, Cmd+Shift+B on macOS to show it). Right-click works too.
- Watch the size meter: green is safe, amber warns that Safari and some managed-bookmark systems may truncate, and red means every browser will refuse the URL.
- Try a starter preset (word count, view source, list images or links, remove CSS, edit page, QR this page, highlight headings) and edit it to your taste.
About this tool
Bookmarklet Builder converts a snippet of JavaScript into a working bookmarklet: a single-line javascript: URL that runs your code on the page you click it from. Paste any JS body, pick how it should be wrapped (a standard IIFE that hides your variables from the page, an async IIFE that lets you use top-level await, or no wrapping at all), and the tool strips line and block comments, collapses whitespace and safe spaces around punctuation, appends a void 0 expression so the browser does not replace the page with whatever the snippet returned, and URL-encodes the whole thing with encodeURIComponent so any character that a URL parser would otherwise misread (a stray %, a quote, a # fragment, a + plus sign) survives intact. The result is shown as a real javascript: URL you can copy and paste into a new bookmark, and as a draggable install button you can drop directly onto your bookmarks bar (Ctrl+Shift+B or Cmd+Shift+B to show it). A live size meter calls out when the encoded URL passes the 2,000 character mark that Safari and some managed bookmark systems start to truncate at, and when it passes 80,000 characters where every browser will refuse to store it. The tool warns if your code contains // comments without minification (the most common reason a bookmarklet does nothing the moment it becomes one line), if you pasted a literal <script> tag, or if you accidentally included the javascript: prefix yourself. Starter presets cover the most-asked classics: word count of the page or selection, view-source, list every image or link in a new tab, strip all CSS for a clean reading view, toggle contentEditable to make the page editable in place, a QR code for the current URL, and an outline highlighter for every heading on the page. Bookmarklets work in Chrome, Edge, Firefox, Brave, and Safari on desktop; mobile support is limited because most mobile browsers do not run javascript: bookmarks from the address bar (on iOS Safari you can still invoke them by typing part of the bookmark name in the address bar). Useful when you want a one-click action that does not need a full browser extension review process, when you are demoing a small script, when you want to share a quick page tweak with a teammate, or when you are extending a tool you use every day with a tiny piece of personal automation. Everything runs in your browser; the source you paste here is never uploaded and there is no signup.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
URL Encoder Decoder
Encode and decode percent-encoded URLs.
Open tool
DeveloperHTML Entity Encoder Decoder
Two-way HTML entity encoder and decoder with named, decimal, and hex modes.
Open tool
DeveloperCSS Minifier
Compress CSS with comment, whitespace, hex, and zero-unit optimizations and a live byte-savings readout.
Open tool
DeveloperHTML Minifier
Compress HTML safely: collapse whitespace, strip comments, drop attribute quotes, shrink boolean attributes.
Open tool
DeveloperJSON Minifier
Compact JSON with live byte savings and a JS literal copy.
Open tool