On this page
Overview
IMask is a JavaScript/TypeScript library for applying input masks to input and contenteditable elements. It supports Pattern, Number, Date, RegExp, Dynamic, and other mask types while exposing displayed value, unmaskedValue, and typed typedValue forms.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Choose Pattern, Number, Date, and other mask types
The library supports pattern, regular-expression, numeric, date, function, dynamic, enum, range, and related masks, including optional sections and custom definitions.
Sources: [1]
Separate displayed, unmasked, and typed values
Input controls expose the formatted value, the formatting-free unmaskedValue, and a typed typedValue for cases such as numbers and dates, separating UI presentation from application data.
Use framework-specific plugins over the same masking engine
The monorepo includes integrations for Vue, Angular, React, React Native, Svelte, and Solid, allowing framework projects to reuse the same masking concepts as vanilla JavaScript.
Sources: [1]
Best fit
Fits phone, currency, date, and code fields that need input guidance
It works well when forms should format values during entry while submitting an unmasked string or typed number/date to application logic.
Sources: [1]
Before adoption
Input masks guide format but do not replace domain validation
A value matching the mask is not proof that a phone number exists or that a numeric value satisfies business constraints. Server-side validation and domain rules remain separate responsibilities.
Sources: [1]
Framework plugins should be checked against core and framework versions
React, Vue, and other wrappers live in the same monorepo, but applications should still verify peer-dependency compatibility with the selected framework version.
Sources: [1]
Official sources
- [1]IMask v7.6.1 README(2026-10-05)
- [2]IMask guide(2026-10-05)
- [3]IMask v7.6.1 package metadata(2026-10-05)
- [4]IMask v7.6.1 release(2026-10-05)
Supplemental curator note
IMask is useful when forms need formatted input for users while application logic consumes a separate unmasked or typed value. The monorepo also provides dedicated integrations for React, Vue, Angular, Svelte, and other frameworks.
Try it in 3 steps
- 1
Install IMask 7.6.1
Pin the reviewed stable release.
npm install --save-exact imask@7.6.1 - 2
Apply a numeric mask to an input
Follow the documented import pattern and attach a number mask to the target input.
import IMask from 'imask'; const input = document.querySelector('#amount'); const mask = IMask(input, { mask: Number, thousandsSeparator: ',' }); - 3
Inspect displayed, unmasked, and typed values
Compare the formatted
value, formatting-freeunmaskedValue, and numerictypedValue.console.log(mask.value); console.log(mask.unmaskedValue); console.log(mask.typedValue);
Growth
Growth trends · Last 30 days
5,182 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 0
- Open PRs
- 17
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- inputmask
- vanilla-js
- Stars
- 5,182
- Forks
- 271
- Watchers
- 27
- Open issues
- 77
- Contributors
- 31
- Owner type
- User
- Primary language
- TypeScript
- License
- MIT
- Repository last updated
- Oct 11, 2024
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Bootstrap174,991 Stars
4 shared tag(s) · 1 shared category(s)
Build responsive interfaces from a CSS/Sass grid, utilities, components, and native JavaScript
MDX - Alpine.js31,960 Stars
4 shared tag(s) · 1 shared category(s)
add state, events, and display behavior directly to HTML for small interactive interfaces
HTML - SortableJS31,186 Stars
4 shared tag(s) · 1 shared category(s)
reorder list items with drag and drop within or across lists while supporting touch input
JavaScript - SweetAlert218,098 Stars
4 shared tag(s) · 1 shared category(s)
replace alert, confirm, and prompt dialogs with WAI-ARIA-aware popups that resolve through Promises
JavaScript - Tippy.js12,240 Stars
4 shared tag(s) · 1 shared category(s)
position tooltips, popovers, and dropdowns with Popper and attach them to hover, focus, or click interactions
JavaScript - PhotoSwipe25,270 Stars
4 shared tag(s)
open image galleries in a lightbox with swipe, zoom, and dynamic loading across mobile and desktop
JavaScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.