Bookmarklet Maker
Paste JavaScript, click Create bookmarklet, and drag the button to your bookmarks bar. Everything happens in your browser — your code is never uploaded.
How to use the Bookmarklet Maker
The Bookmarklet Maker turns ordinary JavaScript into a working bookmarklet. It handles the tedious parts, wrapping, minifying, and URL-encoding, so you get a link you can drag straight to your bookmarks bar. Everything happens in your browser. Your code is never uploaded.
- Paste your JavaScript into the code box. Write it the way you would in the DevTools console. Leave off the
javascript:prefix, since the maker adds it. - Give it a name. This becomes the bookmark's label. Short names fit better on a crowded bar.
- Choose your options:
- Wrap in IIFE puts your code inside
(()=>{ ... })();. That keeps your variables out of the page's global scope and stops the page from being replaced by a return value. Leave it on unless your code is already wrapped. - Minify strips comments and whitespace and shortens variable names. It also removes
//comments safely, which would otherwise break a one-line bookmarklet. - URL-encode percent-encodes characters like
%, spaces, quotes, and#so the bookmark survives intact in every browser.
- Wrap in IIFE puts your code inside
- Generate the bookmarklet, then drag the button to your bookmarks bar, or copy the
javascript:URL and paste it into a bookmark's address field by hand. On a phone, the copy route is the only option. See How to Add a Bookmarklet for mobile steps.
Test the result by clicking it on a real page, not by pasting it into the address bar. Browsers strip or block javascript: there on purpose.
Four bookmarklets to try
Paste any of these into the maker to see how it works. Each one is small enough to understand at a glance.
Show the page's word count
const text = (window.getSelection().toString() || document.body.innerText).trim();
const words = text ? text.split(/\s+/).length : 0;
alert(words.toLocaleString() + ' words, about ' + Math.ceil(words / 230) + ' min read');
Highlight some text first to count only the selection.
Outline every element
const id = 'mk-outline';
const old = document.getElementById(id);
if (old) { old.remove(); return; }
const s = document.createElement('style');
s.id = id;
s.textContent = '*{outline:1px solid rgba(255,0,80,.6)!important}';
document.head.append(s);
Click once to outline everything, and again to remove the outlines. The return works because the maker wraps the code in a function. For a polished version, see CSS Outline Debugger.
Open the page in the Wayback Machine
window.open('https://web.archive.org/web/*/' + encodeURIComponent(location.href), '_blank');
A one-line "send this page somewhere" bookmarklet. Swap in any service that accepts a URL parameter.
Copy the page as a Markdown link
const title = document.title.replace(/[\[\]]/g, '\\$&');
const url = location.href.replace(/[()]/g, c => c === '(' ? '%28' : '%29');
navigator.clipboard.writeText('[' + title + '](' + url + ')')
.then(() => alert('Copied'), () => prompt('Copy this:', '[' + title + '](' + url + ')'));
Brackets in the title and parentheses in the URL are escaped so the link renders correctly. The prompt fallback covers pages that block clipboard access.
Editing an existing bookmarklet
To change a bookmarklet you already have, copy its URL from the bookmark editor, decode it with the Bookmarklet Decoder, paste the readable code here, make your change, and generate a new one. Then replace the URL in your existing bookmark, or drag the new button to your bar and delete the old one. Changing a parameter, such as the default search engine, a highlight color, or a prompt, usually takes less than a minute.
Tips for reliable bookmarklets
- Test in the console first. If it works in DevTools on the target page, it will work as a bookmarklet.
- End statements with semicolons. Minifiers handle this, but if you skip minification, missing semicolons on a single line can merge statements.
- Avoid
innerHTML. Sites that enforce Trusted Types, including Google Search and YouTube, will throw. UsecreateElementandtextContent. - Do not load remote scripts. Many sites block them through CSP, and a remote file can change without your knowledge. Keep everything in the bookmarklet.
- Design for a second click. Give anything you add a unique id and remove it if it already exists. That turns your bookmarklet into a toggle.
- Encode parameters. When building URLs, always pass page data through
encodeURIComponent.
Want the full explanation behind each option? Read How to Create a Bookmarklet (Step by Step). Have a bookmarklet you want to inspect or edit? Use the Bookmarklet Decoder to turn it back into readable code, edit it here, and regenerate.
Frequently asked questions
Is my code sent to a server?
No. The Bookmarklet Maker runs entirely in your browser. Your code is wrapped, minified, and encoded locally and never uploaded.
Should I include javascript: in the code box?
No. Paste plain JavaScript. The maker adds the javascript: prefix to the finished bookmarklet.
Can I use modern JavaScript like arrow functions and async/await?
Yes. All current desktop and mobile browsers support modern syntax in bookmarklets. Keep in mind that popups and clipboard writes after a slow await may be blocked.
Why does my bookmarklet work in the console but not as a bookmark?
Usually it is a // comment, a missing semicolon, or a bare % sign. Turn on Minify and URL-encode and regenerate it.