Taken directly from W3Schools:
Definition and Usage The size attribute specifies the width of an input field.
For
You can't take that literally, as that is not possible.
The width of the element is based on the size attribute and the font size used, but it won't fit that number of characters exactly, because that is not possible.
All characters doesn't have the same width, so the characters llll will easily fit in an input with size="4", but the characters mmmm won't.
Also, there is some extra space added, so an input with size="2" will not be twice as wide as an input with size="1".
What's used as an average character width might depend on the browser. I tested in Firefox, and I haven't found any character that matches exactly, but the character * matches that average width pretty well.