You probably know about Gmail's dot trick — but do you know how many aliases your Gmail address actually has?
Spoiler: if your username is 10 characters, you have 512 aliases.
The Trick
Gmail completely ignores dots (.) in the local part of an email address. This means:
johndoe@gmail.com
john.doe@gmail.com
j.o.h.n.d.o.e@gmail.com
jo.hn.do.e@gmail.com
All four land in the exact same inbox. Every single variant is a valid alias — Google officially documents this behavior.
This is useful for:
- Signing up for trials repeatedly using "different" email addresses
- Creating Gmail filters based on specific aliases
- Testing email registration/validation systems in your app
The Math
For a username with n characters, there are n − 1 positions between characters. Each position can either have a dot or not — giving us:
Total aliases = 2^(n-1)
| Username length | Aliases |
|---|---|
| 5 chars | 16 |
| 6 chars | 32 |
| 8 chars | 128 |
| 10 chars | 512 |
| 12 chars | 2,048 |
My username (yahyawijaya) has 11 characters → 1,024 aliases.
Implementing the Generator
Here's the core logic in vanilla JavaScript:
function generateDotCombinations(username) {
const chars = username.split('');
const n = chars.length;
const positions = n - 1; // number of gaps between chars
const total = Math.pow(2, positions);
const results = [];
for (let i = 0; i < total; i++) {
let combo = chars[0];
for (let j = 0; j < positions; j++) {
// Check if bit j is set in i
if (i & (1 << j)) {
combo += '.';
}
combo += chars[j + 1];
}
results.push(combo);
}
return results;
}
How it works:
- We iterate
ifrom0to2^(n-1) - 1 - Each value of
iis a bitmask — bitjbeing set means "place a dot at positionj" - For
i = 0(binary000): no dots →johndoe - For
i = 1(binary001): dot at position 0 →j.ohndoe - For
i = 5(binary101): dots at positions 0 and 2 →j.oh.ndoe
This gives us all 2^(n-1) combinations in a clean loop.
Handling @gmail.com
When the user inputs a full email like john.doe@gmail.com, we need to:
- Strip existing dots from the local part
- Extract the domain
- Generate combinations on the clean username
- Re-attach the domain
function parseEmail(input) {
const [local, domain] = input.split('@');
const cleanLocal = local.replace(/\./g, ''); // remove existing dots
return { username: cleanLocal, domain: domain || 'gmail.com' };
}
function generate(emailInput) {
const { username, domain } = parseEmail(emailInput);
const combos = generateDotCombinations(username);
return combos.map(c => `${c}@${domain}`);
}
The Full Tool
I wrapped this into a browser-based generator with:
- Copy-all button (copies the full list to clipboard)
- Stats showing total combinations + formula
- Works with any domain, not just
@gmail.com - Zero dependencies, zero server — runs entirely in the browser
👉 Try it: yahyawijaya.com/tools/email-dot
One Gotcha
Gmail's dot-ignoring behavior only applies to Gmail addresses — not Google Workspace / G Suite custom domains. So john.doe@yourcompany.com and johndoe@yourcompany.com may or may not be the same, depending on how the mail server is configured.
Also: the plus alias trick (username+tag@gmail.com) is a separate feature — dots and plus signs are two independent Gmail alias mechanisms.
Yahya Wijaya — Software Engineer
More tools at yahyawijaya.com/tools
Top comments (1)
This is a neat breakdown! I'm