Word Prefix Adder

Prepends a chosen prefix to the start of every word in your text, useful for generating hashtags, tagging keywords, or marking each token in a sentence. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-23

Overview

Introduction

Turning a list of keywords into hashtags, or marking every word in a sentence with a shared symbol, means prefixing each word individually while leaving the spacing between them untouched.

It runs entirely client-side, so nothing you paste is ever uploaded to a server.

What Is Word Prefix Adder?

A word-based prefixing tool that prepends your chosen prefix to the start of every word in the input, while leaving the original whitespace between words exactly as it was.

It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.

How Word Prefix Adder Works

The tool splits the input on runs of whitespace using a capturing regular expression, so the whitespace pieces are kept in the resulting array, then prepends the prefix to every non-whitespace piece and rejoins everything.

The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.

When To Use Word Prefix Adder

Use it to turn a list of keywords into hashtags, mark every token in a sentence with a shared symbol, or prefix each word for a custom markup format.

It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.

Features

Advantages

  • Preserves the exact original whitespace between words, including multiple spaces or tabs.
  • Works on any whitespace-separated text, not just single-spaced sentences.
  • Splits with a capturing group so whitespace runs are kept as entries of their own, which is what lets tabs and multiple spaces survive exactly.

Limitations

  • Splits purely on whitespace, so punctuation attached to a word (like a trailing comma) is treated as part of that word.
  • Applies to every word without exception, so there is no way to prefix only the words matching some condition.

Examples

Generating hashtags from keywords

Input

alpha beta gamma

Output

#alpha #beta #gamma

With prefix '#', each of the three space-separated words gets the symbol prepended, and the single spaces between them are preserved.

Best Practices & Notes

Best Practices

  • Remember that punctuation attached to a word is treated as part of it, so 'word,' becomes '#word,' rather than '#word,'.
  • Strip punctuation first when generating hashtags, since a trailing comma is carried into the tag and breaks it.
  • Check for words that already carry the prefix before running, because nothing is deduplicated for you.

Developer Notes

The implementation uses `input.split(/(\s+)/)` with a capturing group so whitespace runs are kept as separate array entries, then maps only the non-whitespace entries with `prefix + part` before rejoining with `join("")`.

Word Prefix Adder Use Cases

  • Generating hashtags from a list of keywords
  • Prefixing every word in a sentence for a custom markup or DSL
  • Marking each token in a tag list with a shared symbol

Common Mistakes

  • Expecting the prefix to apply per line rather than per word; use Line Prefix Adder for line-based prefixing instead.
  • Running it twice over the same text and ending up with a doubled prefix on every single word.

Tips

  • Use Word Suffix Adder alongside this tool to wrap every word with both a prefix and a suffix.
  • Because whitespace is preserved exactly, a formatted list keeps its indentation and column alignment after prefixing.

References

Frequently Asked Questions