Suggest an editImprove this articleRefine the answer for “What is the difference between the GET and POST methods when submitting a form?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)The **`GET`** and **`POST`** methods are two different ways an HTML form sends data to the server: `GET` appends data to the URL after the `?` character, while `POST` sends it "inside" the request, not visible in the address. **Key point:** `GET` suits search and filters, since the data is visible and the link can be shared, while `POST` suits login, payment, and registration, since the data is hidden and safer.Shown above the full answer for quick recall.Answer (EN)ImageThe `GET` and `POST` methods are two different ways an HTML form **sends data to the server**. Both are used in the `method` attribute of the `<form>` tag, but they **work differently**: they differ in **where the data is stored, what the user can see, the level of security, and the area of application**. --- ### 1. The main difference, **where the data ends up** | Method | How data is passed | |---|---| | **GET** | Data is appended to the address bar (URL) after the `?` character | | **POST** | Data is sent "inside" the request, not visible in the address | Example: #### GET: ```html <form action="/search" method="get"> <input name="q" value="phone"> <button>Search</button> </form> ``` → the browser will send: ```javascript /search?q=phone ``` #### POST: ```html <form action="/login" method="post"> <input name="user" value="Oleh"> <input name="pass" value="12345"> <button>Log in</button> </form> ``` → the browser will send: ```javascript POST /login Content-Type: application/x-www-form-urlencoded user=Oleh&pass=12345 ``` The address stays simply `/login`, with no data. --- ### 2. What the user sees | Characteristic | GET | POST | |---|---|---| | Visible in the address bar | Yes | No | | Can be saved or shared as a link | Yes | No | | Security | Low (all data in the URL) | Higher (data is hidden) | Example: If you submit a login form via GET, the address might become: ```javascript /login?user=Oleh&pass=12345 ``` → the password will be visible to everyone. That is why such forms **always use POST**. --- ### 3. Limitations and size | Parameter | GET | POST | |---|---|---| | Maximum length | limited (~2000 characters) | practically unlimited | | File transfer | not possible | possible | | Browser caching | yes | no | | Added to history | yes | no | --- ### 4. Where it is applied | Method | Where it is used | Example | |---|---|---| | **GET** | Search, filters, navigation | `/search?q=python` | | **POST** | Registration, login, payment, form submissions | `/register`, `/checkout` | A simple rule: - if the action **does not change anything** (only requests data) → `GET`; - if the action **changes data** (submitting, adding, deleting) → `POST`. --- ### 5. SEO and caching - `GET` pages are indexed by search engines (suitable for links and filters); - `POST` pages **are not indexed** and are not saved in history; - `GET` can be safely reloaded (it does not trigger a repeated data submission). --- ### Summary, a short comparison table: | Criterion | **GET** | **POST** | |---|---|---| | Where data is stored | In the URL | In the request body | | Visible to the user | Yes | No | | Length limit | Yes (~2000 characters) | No | | Security | Low | Higher | | Can be bookmarked / shared as a link | Yes | No | | Suited for | Search, filters, links | Login forms, orders, registration | | Indexed by search engines | Yes | No | | Repeat request (page refresh) | Safe | Can cause duplicated actions | --- **In simple terms:** - `GET`: like a **postcard**, everything you write is visible from the outside. - `POST`: like a **letter in an envelope**, the contents are hidden, it's safer, and it suits important data.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.