Replace First/Last N Chars
Swap a fixed number of leading and/or trailing characters of every line for the text you choose.
- Runs in your browser
- Free to use
About this tool
Replace First/Last N Characters removes a fixed number of characters at either end of every line and inserts a replacement, which is useful for masking sensitive suffixes, changing a leading code or normalising records with fixed prefixes.
Content-based alternatives: Remove Prefix/Suffix and Add Prefix/Suffix.
How to use it — quick steps
- 01
Enter the lines
Type or paste the lines in the field above, one item per line. Use Ctrl + V to paste from the clipboard.
- 02
Press "Replace characters"
Press "Replace characters" or Ctrl + Enter. The result appears instantly below the form.
- 03
Read the result
It appears in the dark panel under the form instantly. Every block has [copy] and other actions.
Key features of this tool
Nothing leaves your browser
The processing is plain JavaScript that runs on your device: the text you paste is never uploaded to our servers or to anyone else.
Instant results
Results appear the moment you press the button, even for long inputs, and every block has copy and download actions.
Works everywhere
No installation, no account and no limits: the tool works on desktop and mobile, in any modern browser, as often as you like.
Frequently asked questions
Can I mask data with this?
Yes: replace the last 4 characters with **** to hide the end of card numbers or IDs.
Is the replacement text counted?
No, the N characters are removed and the replacement is inserted whatever its length.
Are my files or data uploaded?
No. The tool is plain JavaScript that runs in your browser; the files or data you provide here are never uploaded to our servers.