# Mask an email address for logs

Keep the first character and the domain; hide the rest of the local part.

Canonical: https://1loc.dev/email/mask-an-email-address/
Version: 1.0.0
Runtime: JavaScript · Node.js 22 / modern browsers
Verification: Local fixtures; no external services
Updated: 2026-10-28

## Implementation

```javascript
function maskEmail(address) { return `${address.slice(0, 1)}•••${address.slice(address.lastIndexOf('@'))}`; }
```

## Input

```json
"ana.silva@example.com"
```

## Expected output

```json
"a•••@example.com"
```

## Edge case

Input:
```json
"a@example.com"
```
Output:
```json
"a•••@example.com"
```

## Limits

- Masking reduces exposure in logs; it is not anonymization, and the domain stays visible.
- The mask has a fixed width, so it does not reveal the length of the local part. Prefer logging a message or delivery identifier instead.

The lab validates types and size before calling this function. Add equivalent validation at your own trust boundary.

## Source and license

Author: Oveyon, written for this edition; not part of the original 1loc collection.
Copyright (c) 2026 Oveyon
License: MIT — https://1loc.dev/licenses/
Maintainer: Oveyon
