The VARCHAR data type is a variable-length character string. For example, a column declared as VARCHAR(25) holds up to 25 bytes in each row, depending on the length of the strings that are loaded. For details and examples, see Trailing Blanks in Character Data.

{ VARCHAR | CHARACTER VARYING } [ ( { bytes | MAX | ANY } ) ]

Note that VARCHAR columns can hold a given number of bytes, not characters.

The MAX and ANY keywords define the column with the maximum length of 64000 bytes (equivalent to VARCHAR(64000)). If you create a VARCHAR column without specifying a length, the default length is 256 bytes. For example:
premdb=# create table var(c1 varchar, c2 varchar(max), c3 varchar(any), c4 varchar(100));
premdb=# \d var
              Table "public.var"
 Column |           Type           | Modifiers 
 c1     | character varying(256)   | 
 c2     | character varying(64000) | 
 c3     | character varying(64000) | 
 c4     | character varying(100)   | 

Distribution: Hash (c1)

An attempt to load a string that is longer than the specified length of a VARCHAR column results in a value too long error.

Note: The maximum length of a row in a table is 64231 bytes. See Maximum Row Size.