· QuickLab
What we learned building 42 web tools that run entirely in your browser
Removing modulo bias from random numbers, a metronome that never drifts, line diffs with LCS and Markdown that scripts cannot sneak into: the small techniques behind QuickLab’s free tools.
We opened 42 free web tools on QuickLab, from a compound interest calculator to a QR code generator, a ladder game and a metronome. They share one rule: nothing you enter is sent to a server. That means no server costs and no privacy worries, but it also means getting everything right with only the browser. Here are the parts we enjoyed most.
1. Fair randomness with crypto, not Math.random
Pickers use crypto.getRandomValues(). Even then, taking a 32-bit value % n slightly favors smaller results when n is not a power of two. The fix is to reject values from the uneven tail:
function randInt(n) {
const buf = new Uint32Array(1);
const limit = Math.floor(0x100000000 / n) * n;
let x;
do { crypto.getRandomValues(buf); x = buf[0]; } while (x >= limit);
return x % n;
}Team splits and lottery numbers use this with a Fisher–Yates shuffle, which makes every ordering equally likely.
2. A metronome that does not drift
Playing a click inside setInterval drifted whenever the page was busy. Instead, a 25 ms timer schedules every click due in the next 100 ms on the Web Audio clock, which keeps perfect time even if the timer wakes late. The Pomodoro timer uses the same idea, computing time left as “end time minus now” so background tabs stay accurate.
setInterval(() => {
while (next < ctx.currentTime + 0.1) {
playClick(next);
next += 60 / bpm;
}
}, 25);3. Line diffs with the longest common subsequence
The diff checker finds the longest common subsequence of lines with dynamic programming, then marks everything else as added or removed. The table grows with lines × lines, so very large inputs fall back to a whole-file comparison to protect memory.
4. Markdown that scripts cannot sneak into
Our Markdown previewer escapes all input first and only then turns Markdown syntax into tags, so <script> shows up as text. Links and images are only created for http, https and mailto URLs.
5. Image conversion without uploads
The image converter redraws the photo on a canvas and exports it with toBlob(). Redrawing pixels also drops EXIF data such as GPS location. For JPG we paint a white background first so transparent areas do not turn black.
6. Assumptions matter more than formulas
Finance formulas are textbook material. The real work was choosing assumptions: deposits at the start or end of the month, converting annual returns with a twelfth root rather than dividing by twelve, how tax is applied. Every assumption is written next to the tool so you can tell why a bank’s number differs.
Found a wrong result or a rough edge? Please tell us via the contact page.