Format Code Now
/
Web & markupHTML URL Input Generator Next: Color Desaturation Tool ›

HTML URL Input Generator

WM-44

Type a label and a placeholder, add an optional pattern, and copy a labelled url input. The browser checks that the value is an absolute URL.

Runs in your browser. Nothing is uploaded.

Key: value lines (label: is required; also name:, value:, placeholder:, pattern:, list:, minlength:, maxlength:, size:, required:, readonly:, disabled:)

HTML

How to use it

  1. Write label:, then name:, placeholder:, pattern:, value: and the limits you need.
  2. Add required: true if the field cannot be empty.
  3. Copy the label and input.
  4. Validate the value again on your server.

What the browser checks

An input of type url must hold an absolute URL with a scheme, so example.com fails and https://example.com passes. An empty field is allowed unless it is required. Browsers also trim spaces around the value. Any scheme counts as valid, including ftp: and javascript:, so a server check on the scheme still matters. A pattern adds a second test, such as accepting only https:, and both must pass. The tool tests a starting value: line the same way and refuses a relative one.

placeholder, list and label

The placeholder shows an example such as https://example.com, but it disappears while typing and is not a label, so the tool always writes a real label linked by for and id. A list: line points to a datalist by id, to offer suggestions as the person types; you must write that datalist yourself. The tool does not check that the address exists or loads.

Error messages and what to do

MessageWhat it meansFix
The value must be an absolute URL such as https://example.com.The value: line was not a full URL.Add the scheme, for example https://.
Add a "label:" line. An input needs a visible label so screen readers can name it.No label: line was found.Add label: and the visible text.

Questions people ask

How do I add a URL field in HTML?

Use an input of type url with a label and a name. Browsers then check that the value is an absolute URL when the form is submitted.

Why does my url input reject example.com?

The type needs a full absolute URL with a scheme, such as https://example.com. A bare domain has no scheme, so it fails. Say so in the placeholder or help text.

How do I only accept https URLs?

Add a pattern such as https://.* to the input. The browser then requires both a valid URL and a match. Check the scheme on the server as well.

Does type url check that a site exists?

No. It only checks the form of the text. A well-formed address to a page that does not exist passes. Only a request from your server or a script can show that a page responds, and this page makes no network requests.

Can I let people type more than one URL?

The url input does not support the multiple attribute; email inputs do. For several addresses, use several fields or a textarea you split on the server.

About this tool

Writes a label and an input of type url. Output is a label plus the control, joined by the for and id attributes; the id comes from an id: line, else the name, else the label. Browsers check that the value is an absolute URL with a scheme, so example.com alone fails and https://example.com passes. A starting value: line is tested the same way and refused when it is not an absolute URL. A pattern narrows what is accepted, for example only https: addresses, and is tested as a regular expression before it is written. The list: line links to a datalist by its id; the tool does not write the datalist. The check runs in the browser and a server must check again. Optional lines: id:, class:, title:, lang:, data-* and aria-*.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.