HTML URL Encode
HTML Uniform Resource Locators (URLs)
A URL is another name for a web address. It is used to locate documents, images, or other resources on the internet.
A URL can be written using words (such as w3schools.com) or an IP address (such as 192.168.20.50).
Most users prefer domain names because they are easier to remember than numeric IP addresses.
What Is a URL?
Web browsers use URLs to request pages from web servers.
URL stands for Uniform Resource Locator, which means a standardized way to address resources on the web.
URL Structure
A typical URL follows this syntax:
scheme://prefix.domain:port/path/filename
URL Parts Explained
- scheme – Defines the protocol (for example,
httporhttps) - prefix – Domain prefix, usually
www - domain – The website name (for example,
w3schools.com) - port – Port number on the server (default is 80 for HTTP)
- path – Location of the resource on the server
- filename – The specific file being requested
Common URL Schemes
| Scheme | Description | Usage |
|---|---|---|
| http | HyperText Transfer Protocol | Standard web pages (not encrypted) |
| https | Secure HyperText Transfer Protocol | Encrypted and secure web pages |
| ftp | File Transfer Protocol | Uploading and downloading files |
| file | Local file access | Files on your own computer |
URL Encoding
URLs can only be transmitted using the ASCII character set.
If a URL contains characters outside ASCII, they must be converted using URL encoding.
URL encoding replaces unsafe characters with a percent sign (%) followed by hexadecimal values.
Spaces in URLs
URLs cannot contain spaces.
- A space is replaced with
+ - Or encoded as
%20
Character Encoding in URLs
The default character encoding in HTML5 is UTF-8.
The same character may be encoded differently depending on the character set.
| Character | Windows-1252 | UTF-8 |
|---|---|---|
| € | %80 | %E2%82%AC |
| £ | %A3 | %C2%A3 |
| © | %A9 | %C2%A9 |
| ® | %AE | %C2%AE |
Summary
URLs provide a standardized way to locate resources on the web.
Understanding URL structure and encoding helps ensure correct linking, data transfer, and international character support.