Easily build and embed forms on your site. Try HubSpot Forms for free.

Can I auto-populate form fields using a query string?

Last updated: March 8, 2018

Available For:

Marketing: Basic, Pro, Enterprise
Sales: N/A

Yes, you can add query strings to the URL of one of your landing pages to auto-populate field values in the form on the page. This works for the following field types: single-line text, multi-line text, dropdown select, multiple checkboxes, number, radio select, single checkbox, and date picker. This also works for hidden form fields. Please note that it is not possible to use query strings to auto-populate dependent form fields

Create query strings with set values

  • In your HubSpot Marketing BasicProfessional, or Enterprise account, navigate to Contacts > Contacts Settings.
  • Copy the internal name of the property to use in your query string. 


  • Create your URL:
    • Add a question mark to the end of the URL of the landing page that contains the form.  
    • Add the internal name of the property, followed by an equal sign and the desired value, which will be auto-populated in the field. There are some rules for adding values, depending on the field type of the property:
      • Single checkbox query strings must contain either a true or false value, not yes or no.
      • Date picker query strings must contain a date value in a MM/DD/YYYY format.
      • Multiple checkboxes values must match the property's value options exactly, with a semi-colon separating multiple values.
      • Radio select and dropdown select values must match the property's value options exactly.
    • Separate multiple properties with an ampersand.
Here is an example and a breakdown of a properly formatted URL with query strings:


  • Beginning of query string and single line text field: ?firstname=John
  • Single-line text field: &lastname=Smith
  • Single-line text field: &email=jsmith@email.com
  • Dropdown select field: &favorite_season=Winter
  • Multiple checkboxes field: &favorite_natural_disasters=Blizzard;Hurricane
  • Number field: &favorite_number=7
  • Radio select field: &will_you_come_to_the_party=Maybe
  • Single checkbox field: &do_you_like_parties=true
  • Date picker field: &date_of_party=01/07/2016

Create dynamic query strings with personalization tokens

You can also create personalized URLs that will auto-populate a form based on known contacts' information. Here's how this would work in a HubSpot email:

Please note: this will only function as intended if the link is going to HubSpot-hosted content with a HubSpot form and the link is placed on a HubSpot-hosted page (or HubSpot email) or an externally hosted page with the HubSpot tracking code.
  • Navigate to Content Email
  • Create a new email or hover over an existing email and click Edit.
  • First, you'll need to find the code for any personalization tokens you'd like to use in your URL. To do this, click the personalization token icon in the rich text toolbar. 

  • Select the personalization token you'd like to add to your URL. Continue to add additional personalization tokens as needed. 
  • The personalization tokens will now appear in the body of your email. Click the source code (<>) icon in the rich text toolbar to see the HTML of your email. 

  • In the source code, you'll see the raw code for each personalization token you've added the body of your email. Each one will be surrounded by double brackets . Highlight one of them (in this case, we want to use first name so the token code is {{contact.firstname}} ), then right click and select Copy. Click Cancel and close to exit the source code. 

  • Now click on the link to which you'd like to add your query string, then select Options.

  • Add a question mark at the end of the Link URL, then the internal name of the property (see above), then an equal sign, then paste the personalization token code. Click Update link

Repeat this as needed for any other personalization tokens you included in your body. Add an ampersand (&) between each query string.

To test your link, send yourself a test email as a particular contact, following the steps here.

New Call-to-action

Was this article helpful?