W3cubDocs

/Support Tables

maxlength attribute for input and textarea elements

Declares an upper bound on the number of characters the user can input. Normally the UI ignores attempts by the user to type in additional characters beyond this limit.

Spec https://html.spec.whatwg.org/multipage/forms.html#attr-input-maxlength
Status WHATWG Living Standard
IE Edge Firefox Chrome Safari Opera
    147 144    
    146 143 TP  
    145 142 26.1  
11 141 144 141 26.0 122
10 140 143 140 18.5-18.6 121
9 (1,2,3) 139 142 139 18.4 120
8 (1,2,3) 138 141 138 18.3 119
Show all
7 (1,2,3) 137 140 137 18.2 118
6 (1,2,3) 136 139 136 18.1 117
5.5 135 138 135 18.0 116
  134 137 134 17.6 115
  133 136 133 17.5 114
  132 135 132 17.4 113
  131 134 131 17.3 112
  130 133 130 17.2 111
  129 132 129 17.1 110
  128 131 128 17.0 109
  127 130 127 16.6 108
  126 129 126 16.5 107
  125 128 125 16.4 106
  124 127 124 16.3 105
  123 126 123 16.2 104
  122 125 122 16.1 103
  121 124 121 16.0 102
  120 123 120 15.6 101
  119 122 119 15.5 100
  118 121 118 15.4 99
  117 120 117 15.2-15.3 98
  116 119 116 15.1 97
  115 118 115 15 96
  114 117 114 14.1 95
  113 116 113 14 94
  112 115 112 13.1 93
  111 114 111 13 92
  110 113 110 12.1 91
  109 112 109 12 90
  108 111 108 11.1 89
  107 110 107 11 88
  106 109 106 10.1 87
  105 108 105 10 86
  104 107 104 9.1 85
  103 106 103 9 84
  102 105 102 8 83
  101 104 101 7.1 82
  100 103 100 7 81
  99 102 99 6.1 80
  98 101 98 6 79
  97 100 97 5.1 78
  96 99 96 5 77
  95 98 95 4 (1,2,3) 76
  94 97 94 3.2 (1,2,3) 75
  93 96 93 3.1 74
  92 95 92   73
  91 94 91   72
  90 93 90   71
  89 92 89   70
  88 91 88   69
  87 90 87   68
  86 89 86   67
  85 88 85   66
  84 87 84   65
  83 86 83   64
  81 85 81   63
  80 84 80   62
  79 83 79   60
  18 (4) 82 78   58
  17 (4) 81 77   57
  16 (4) 80 76   56
  15 (4) 79 75   55
  14 (4) 78 74   54
  13 (4) 77 73   53
  12 (4) 76 72   52
    75 71   51
    74 70   50
    73 69   49
    72 68   48
    71 67   47
    70 66   46
    69 65   45
    68 64   44
    67 63   43
    66 62   42
    65 61   41
    64 60   40
    63 59   39
    62 58   38
    61 57   37
    60 56   36
    59 55   35
    58 54   34
    57 53   33
    56 52   32
    55 51   31
    54 50   30
    53 49   29
    52 48   28
    51 47   27
    50 (4) 46   26
    49 (4) 45   25
    48 (4) 44   24
    47 (4) 43   23
    46 (4) 42   22
    45 (4) 41   21
    44 (4) 40   20
    43 (4) 39   19
    42 (4) 38   18
    41 (4) 37   17
    40 (4) 36   16
    39 (4) 35   15
    38 (4) 34   12.1 (1)
    37 (4) 33   12 (1)
    36 (4) 32   11.6 (1)
    35 (4) 31   11.5 (1)
    34 (4) 30   11.1 (1)
    33 (4) 29   11 (1)
    32 (4) 28   10.6 (1)
    31 (4) 27   10.5 (1)
    30 (4) 26   10.0-10.1 (1)
    29 (4) 25   9.5-9.6 (1)
    28 (4) 24   9
    27 (4) 23    
    26 (4) 22    
    25 (4) 21    
    24 (4) 20    
    23 (4) 19    
    22 (4) 18    
    21 (4) 17    
    20 (4) 16    
    19 (4) 15    
    18 (4) 14    
    17 (4) 13    
    16 (4) 12    
    15 (4) 11    
    14 (4) 10    
    13 (4) 9    
    12 (4) 8    
    11 (4) 7    
    10 (4) 6    
    9 (4) 5    
    8 (4) 4    
    7 (4)      
    6 (4)      
    5 (4)      
    4 (4)      
    3.6 (1,2,3)      
    3.5 (1,2,3)      
    3 (1,2,3)      
    2 (1,2,3)      
Safari on iOS Opera Mini Android Browser Blackberry Browser Opera Mobile Android Chrome Android Firefox IE Mobile Android UC Browser Samsung Internet QQ Browser Baidu Browser KaiOS Browser
26.1                        
26.0 all (1) 141 (6) 10 80 (6) 141 (6) 143 (6) 11 15.5 28 (6) 14.9 13.52 3.0-3.1 (4)
18.5-18.6   4.4.3-4.4.4 7 12.1 (1)     10   27 (6)     2.5 (4)
18.4   4.4   12 (1)         26 (6)      
18.3   4.2-4.3   11.5 (1)         25 (6)      
Show all
18.2   4.1   11.1 (1)         24 (6)      
18.1   4   11 (1)         23 (6)      
18.0   3   10 (1)         22 (6)      
17.6-17.7   2.3             21 (6)      
17.5   2.2             20 (6)      
17.4   2.1             19.0 (6)      
17.3                 18.0 (6)      
17.2                 17.0 (6)      
17.1                 16.0 (6)      
17.0                 15.0 (6)      
16.6-16.7                 14.0 (6)      
16.5                 13.0 (6)      
16.4                 12.0 (6)      
16.3                 11.1-11.2 (6)      
16.2                 10.1 (6)      
16.1                 9.2 (6)      
16.0                 8.2 (6)      
15.6-15.8                 7.2-7.4 (6)      
15.5                 6.2-6.4 (6)      
15.4                 5.0-5.4 (6)      
15.2-15.3                 4 (6)      
15.0-15.1                        
14.5-14.8                        
14.0-14.4                        
13.4-13.7                        
13.3                        
13.2                        
13.0-13.1                        
12.2-12.5                        
12.0-12.1                        
11.3-11.4                        
11.0-11.2                        
10.3                        
10.0-10.2                        
9.3                        
9.0-9.2                        
8.1-8.4 (5)                        
8 (5)                        
7.0-7.1                        
6.0-6.1                        
5.0-5.1                        
4.2-4.3                        
4.0-4.1                        
3.2                        

Notes

  1. <textarea>'s' UI does not prevent the user from typing additional characters beyond the maxlength limit.

  2. Does not support the HTMLTextAreaElement.maxLength DOM property.

  3. Does not support ValidityState.tooLong. In some cases, this is because .validity is not supported in the first place.

  4. Does not support ValidityState.tooLong correctly in the (unlikely) case of the value being initially set too long, then changed by the user to a still incorrect state. See Firefox bug and MS Edge bug.

  5. <input>'s UI does not prevent the user from typing additional characters beyond the maxlength limit between two existing characters of the string.

  6. Allows text beyond maxlength to be entered at first, but removes all characters past the maxlength when focus is lost.

Bugs

  • In Opera 12.1 & below ValidityState.tooLong is true when the input's initial value exceeds the maxlength. Per the spec, it should instead be false until the user edits the value.

Resources

Data by caniuse.com
Licensed under the Creative Commons Attribution License v4.0.
https://caniuse.com/maxlength