imaskjsvanilla javascript input mask


  • get and set value and unmasked value easily
  • no external dependencies
  • Supports all major browsers and IE11+ *need older?
  • RegExp mask
  • Function mask
  • Number mask (integer and decimal support)
  • Date mask (with various format support)
  • Dynamic/on-the-fly mask
  • Pattern mask
    • show placeholder always or when needed
    • unmasked value can contain fixed parts
    • optional input parts (greedy)
    • custom definitions
    • reusable groups
  • React/React Nativebeta/Angular/Vue plugins
var regExpMask = new IMask(
    mask: /^[1-6]\d{0,5}$/
learn more
var phoneMask = new IMask(
  document.getElementById('phone-mask'), {
    mask: '+{7}(000)000-00-00'
learn more
var numberMask = new IMask(
    mask: Number,
    min: -10000,
    max: 10000,
    thousandsSeparator: ' '
learn more
var dateMask = new IMask(
    mask: Date,
    min: new Date(2000, 0, 1),
    max: new Date(2020, 0, 1),
    lazy: false
learn more
var dynamicMask = new IMask(
    mask: [
        mask: '+{7}(000)000-00-00'
        mask: /^\S*@?\S*$/
learn more

I'm happy to present you one of the best JS libraries for the user input formatting. My goal is to create the most simple, convenient and yet extensible API, which I think I achieved as possible. Also with a great support of the community plugins for the major JS frameworks were created.

I've been working on my own enthusiasm for more than a year, not receiving any payment for my work. Nevertheless one good man made a donation. This support is very important for me. Thank you.

Right now I would like to proceed with several new features, but I would like to get some feedback from the community. Please vote on issue which is important to you and you can always support and speed up the development process by making a donation - this way I will be sure that my work matters to someone.

Further Plans

In any case, I'm going to continue fixing bugs, updating the dependencies and maintaining the repo in general.