Toolvito

Works on this device

Hsts Policy Generator

Make a Strict-Transport-Security (HSTS) header that tells browsers to use only HTTPS for your site. Check a header you already send, or plan a rollout that makes max-age longer step by step.

Enter your values

Choose how long browsers keep using HTTPS only, and whether the rule covers subdomains and the preload list.

Your values

How long a browser keeps using HTTPS only for your site. 31,536,000 seconds is 365 days.

Tick it only when every subdomain, such as www and api, works over HTTPS.

Browsers then use HTTPS for your domain before the first visit. Removal from the list takes a long time.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose the button below them.

How to use the HSTS policy generator

  1. Choose Make a Strict-Transport-Security header. Type max-age in seconds, or pick a common value.
  2. Tick includeSubDomains only when every subdomain works over HTTPS. Tick preload only when you are ready to ask for the HSTS preload list.
  3. Choose Make the header. Copy the header line, or the line for nginx or the Apache HTTP Server.
  4. To read a header you already send, choose Check a Strict-Transport-Security header and paste it.
  5. To start safely, choose Plan a step-by-step rollout. The plan gives the dates of each stage.

The rules

  • max-age is required. It is the number of seconds a browser keeps using HTTPS only for your host (RFC 6797, section 6.1.1). Each answer with the header starts this time again. max-age=0 tells a browser to forget the rule.
  • includeSubDomains has no value. It makes the rule cover every subdomain (section 6.1.2).
  • Directives are separated by semicolons, names are not case-sensitive, and each directive may appear only once. Browsers ignore a field that breaks these rules, and ignore directives they do not know (section 6.1).
  • Send the header only over HTTPS. Browsers ignore it over plain HTTP (section 8.1).
  • preload is not part of RFC 6797. It is read by the HSTS preload list, which browsers build in. The list states its own requirements: a max-age of at least 31,536,000 seconds (365 days), includeSubDomains and preload in the header, a valid certificate, a redirect from HTTP to HTTPS on the same host, and HTTPS on every subdomain.

Worked example

With max-age 31,536,000 and includeSubDomains ticked, the header is Strict-Transport-Security: max-age=31536000; includeSubDomains. Browsers keep HTTPS only for 365 days. preload is missing, so the header requirements of the preload list are not all met. Tick preload and they are.

The rollout plan starting on 2 November 2026 with its starting rows has four stages: 300 seconds for 7 days, then 604,800 seconds for 14 days, then 2,592,000 seconds for 30 days, then 63,072,000 seconds (730 days) from 23 December 2026, 51 days after the start. If you stopped at the end of the third stage, browsers that saw the header on 23 December 2026 could keep HTTPS only until 22 January 2027.

Limits you should know

  • The tool writes and reads text only. It does not open your site, test your certificate or check your redirects. Check them on your server.
  • The preload list's requirements are stated as that list gives them. They are not rules of RFC 6797, and the list may change them; read hstspreload.org before you ask to be added.
  • Being removed from the preload list takes a long time, often months, because browsers ship the list with their updates.
  • The nginx and Apache lines are examples of the usual directive. Put them where your HTTPS site is set up and test them.

Related tools