
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
invisible-strings
Advanced tools
Translate strings into invisible, zero-width strings, back and forth.
Convert regular text into invisible, zero-width Unicode characters and back again.
Invisible Strings is a lightweight TypeScript library that allows you to convert normal text into strings composed of invisible Unicode characters. These "invisible strings" can be embedded in other text without being visible to readers, but they can be programmatically decoded back to the original text.
# Using npm
npm install invisible-strings
# Using yarn
yarn add invisible-strings
# Using pnpm
pnpm add invisible-strings
import is from 'invisible-strings';
// Create a new instance with a default character mapping
const { toInvisible, fromInvisible } = is();
// Convert a string to invisible characters
const hiddenMessage = toInvisible('Hello World');
console.log('Hidden message:', hiddenMessage); // Outputs invisible characters
// Convert the invisible string back to normal text
const visibleMessage = fromInvisible(hiddenMessage);
console.log('Visible message:', visibleMessage); // Outputs: "Hello World"
The library also provides tagged template literals for more elegant usage:
import is from 'invisible-strings';
const { visible, invisible } = is();
// Convert to invisible using template literal
const hiddenText = invisible`This text will be invisible`;
// Convert back to normal text
const normalText = visible`${hiddenText}`;
console.log(normalText); // Outputs: "This text will be invisible"
You can also provide your own dictionary for more control:
import is, { getDictionary } from 'invisible-strings';
// Get a randomized dictionary
const customDictionary = getDictionary();
// Create a new instance with the custom dictionary
const { toInvisible, fromInvisible } = is(customDictionary);
// Use the same dictionary to encode and decode
const hiddenMessage = toInvisible('Secret message');
const visibleMessage = fromInvisible(hiddenMessage);
Alternatively, you can use the helpers directly from the main export:
import is from 'invisible-strings';
// Access helper functions
const customDictionary = is.helpers.getDictionary();
const reverseDictionary = is.helpers.getReverseDictionary(customDictionary);
// Create a new instance with the custom dictionary
const { toInvisible, fromInvisible } = is(customDictionary);
The default export is a function that returns an object with the following methods:
is(initialDictionary?: Dictionary) => {
dictionary: Dictionary;
toInvisible: (input: string) => string;
fromInvisible: (input: string) => string;
invisible: (strings: TemplateStringsArray, ...values: string[]) => string;
visible: (strings: TemplateStringsArray, ...values: string[]) => string;
}
The library provides several helper functions that can be accessed through the main export's helpers property:
import is from 'invisible-strings';
// Access helpers
const { getDictionary, getReverseDictionary, toInvisible, fromInvisible, shuffleArray } = is.helpers;
These helper functions include:
getDictionary() - Creates a new randomized character mapping dictionarygetReverseDictionary(dictionary) - Reverses a character mapping dictionarytoInvisible(dictionary, input) - Converts a string to invisible characters using the provided dictionaryfromInvisible(reverseDictionary, input) - Converts invisible characters back to a normal stringshuffleArray(array) - Utility function to shuffle an arrayFor detailed information about these helpers and how they work, please see the CONTRIBUTING.md file.
Invisible Strings works by:
The library uses various zero-width and other invisible Unicode characters to encode your text. These characters include:
This library uses standard JavaScript and Unicode characters, making it compatible with all modern browsers.
Contributions are welcome! Please see our CONTRIBUTING.md for details on how to contribute, the project structure, and the helper functions implementation details.
MIT © Yoann Moinet
FAQs
Translate strings into invisible, zero-width strings, back and forth.
We found that invisible-strings demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.