Root URL: https://chart.googleapis.com/chart?

QR code requests support the following URL query parameters after the ? in the root URL:

ParameterRequired or OptionalDescription
cht=qrRequiredSpecifies a QR code.
chs=<width>x<height>RequiredImage size.
chl=<data>RequiredThe data to encode. Data can be digits (0-9), alphanumeric characters, binary bytes of data, or Kanji. You cannot mix data types within a QR code. The data must be UTF-8 URL-encoded. Note that URLs have a 2K maximum length, so if you want to encode more than 2K bytes (minus the other URL characters), you will have to send your data using POST.
choe=<output_encoding>OptionalHow to encode the data in the QR code. Here are the available values:
  • UTF-8 [Default]
  • Shift_JIS
  • ISO-8859-1
chld=<error_correction_level>|<margin>Optional
  • error_correction_level - QR codes support four levels of error correction to enable recovery of missing, misread, or obscured data. Greater redundancy is achieved at the cost of being able to store less data. See the appendix for details. Here are the supported values:
    • L - [Default] Allows recovery of up to 7% data loss
    • M - Allows recovery of up to 15% data loss
    • Q - Allows recovery of up to 25% data loss
    • H - Allows recovery of up to 30% data loss
  • margin - The width of the white border around the data portion of the code. This is in rows, not in pixels. (See below to learn what rows are in a QR code.) The default value is 4.

 

Example:

QR code
cht=qr
chl=Hello+world
choe=UTF-8

QR Code Details [Optional Reading]

Here is a little more about how QR codes work; you don't necessarily need to know this to be able to generate a QR code.

QR codes are squares, with an equal number of rows and columns. There are a fixed set of QR code sizes: from 21 to 177 rows/columns, increasing in steps of four. Each configuration is called a version. The more rows/columns, the more data the code can store. Here is a summary of the versions:

  • Version 1 has 21 rows and 21 columns, and can encode up to 25 alphanumeric characters
  • Version 2 has 25 rows and 25 columns, and can encode up to 47 alphanumeric characters
  • Version 3 has 29 rows and 29 columns, and can encode up to 77 alphanumeric characters
  • ...
  • Version 40 has 177 rows and 177 columns, and can encode up to 4,296 alphanumeric characters

Don't confuse the number of rows and columns with size of the QR code image. The pixel size of the code is determined usingchs as usual.

The API will determine which version to use, based on the amount of data you provide.

The appropriate QR code version will be returned depending on the number of characters you provide. For example, if you provide 55 alphanumeric characters, you will get a Version 3 QR code, although this can change if you specify an error correction (EC) level explicitly using the chld parameter.

Before generating your QR code, consider what kind of device is used to read your code: the best QR code readers are able to read Version 40 codes; mobile devices might only be able to read up to Version 4.

The following table summarizes the characteristics of a few different versions:

VersionRows x ColumnsEC levelMaximum characters by EC level and character type
Digits: 0 to 9Alphanumeric: 
0 to 9, A to Z,
space, $ % * + - . / :
BinaryKanji
121x21L41251710
M3420148
Q2716117
H171074
225x25L77473220
M63382616
Q48292012
H3420148
329x29L127775332
M101614226
Q77473220
H58352415
433x33L1871147848
M149906238
Q111674628
H82503421
1057x57L652395271167
M513311213131
Q36422115193
H28817411974
40177x177L7,0894,2962,9531,817
M5,5963,3912,3311,435
Q3,9932,4201,6631,024
H3,0571,8521,273784

+ Recent posts