Home
/
Website Help
/
HTTP Status Codes
/
How to Fix HTTP Error 400 Bad Request (8 Proven Methods)

How to Fix HTTP Error 400 Bad Request (8 Proven Methods)

Sometimes, when trying to access a web page, your browser may return the HTTP error 400 Bad Request and it is hard to tell the actual problem. The 4xx HTTP status codes are client-side errors, and the different codes indicate the reason for the failed request. Here, you can see a detailed explanation of the various HTTP status codes.

“400 Bad Request” is a general error that indicates that your browser sends a request to the website’s server, and the server can’t process or recognize the client request.

The following article will explain what is the “400 Bad Request” error, the most common causes, and how to fix it.

The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing).

In other words, you are trying to access a website by sending a request to the website’s server. The server can’t recognize and process your request – thus, it returns the “400 Bad Request” status code.

The “400 Bad Request” page may be displayed differently. Some browsers may not show the error code and instead display a blank page. Also, it is important to note that the page for this error may be customized on the website’s hosting server. Below is an example of a standard “400 Bad Request” error page.

Screenshot of the http error 400 status code page in Chrome

The causes of the “400 Bad Request” can be various, but usually, they are related to a local issue on your browser or device. In rare cases, the error may be caused by a misconfiguration in the website’s hosting server. In the next section, we will examine the most common cases of a 400 status code.

How to fix the “400 Bad Request” Error?

1. Double-check the domain address

DNS (Domain Name System) is the system that translates user-friendly website names (domains) to server IP addresses. Thus, visitors don’t need to remember long strings of digits but instead use an easy-to-remember name to reach your website. Valid domain names are formed only from letters and very few special characters—fada characters (acute accent) and hyphens (dash). The domain name can’t exceed 63 characters, have empty spaces, or start or end with a “hyphen.”

Example:

  • ⛔️ Incorrect URL – www.example-website-.com or www.example website.com
  • ✅ Correct URL: www.example-website.com/

Examine the URL of the website, and check if you have any other type of special character or empty space in the domain part of the URL. If the address is missing a forward slash after the domain, this may cause the “HTTP 400 Bad Request” Error.

2. Check the submitted URL

As we also pointed out, a malformed URL with incorrect syntax and structure can trigger the server’s “HTTP 400 Error Bad Request” response code. If you manually enter a URL, you may accidentally enter illegal characters or extra special characters that the web servers do not recognize.

Earlier, we used an example of an invalid URL:

https://www.domain.com/support/kb/%%404_not_found_error/

The part of this URL causing the “HTTP 400 Error Bad Request” is “%%.” It is permitted to have special characters in the URL, like “%”, but the web servers consider two or more consecutive special characters an invalid format and will return the 400 status code. Also, pay attention if the URL contains “unsafe” and “unwise” characters, such as “$” , “[” , “]” , “|”. After inspecting the URL, test removing such characters from the URL string. There are many useful online URL encoder/decoder tools that can help you analyze the URL string and detect illegal characters. You may consider this online tool.

3. Clear browser cache or cookies

As we examined, the browser cache is a very common cause of the “HTTP Error 400,” and it is mostly related to outdated or corrupt cached files and saved cookies. All browsers provide the option to clear their cache and cookies. Depending on your preferred browser, the option is reached from the browser’s specific menus. For detailed steps, read this guide on clearing cache and cookies on different browsers.

For clearing the cache on mobile devices, choose one of the articles below:

Another way to examine whether your browser cache is the origin of the error is to test accessing the site from your browser in Incognito/Private window mode. Those modes don’t save cache or cookies, and if you are able to open the requested resource, it means that your browser cache is the culprit.

4. Turn off browser extensions

We discussed the more popular and obvious causes of the HTTP 400 Bad Request status code. However, there are cases when this client error may be triggered by a specific extension installed in your browser. Some extensions’ specific functions may affect the cookie sessions between your browser and the visited site, thus triggering the HTTP 400 Bad Request Error.

Let’s take Chrome as an example. Click on the kebab menu on the top right and select Extensions.

Screenshot of the Settings Menu Extensions option in Chrome browser to disable extensions in attempt to fix the http error 400 status code

You will load the Extensions page listing all installed extensions in your Chrome browser. Test by disabling your installed extensions by turning off the slider for each one.

Screenshot showing how to deactivate Chrome extensions to resolve the HTTP error 400 Bad Request

If the error is gone after deactivating a specific extension, you can conclude that it is affecting your connectivity to the site.

5. Flush the DNS cache

Unsynchronized local DNS cache from your device is also a common reason for the HTTP 400 Error Bad Request. The DNS cache can be cleared from your OS (operation system). Read the following guides on how to clear the DNS cache on your OS:

6. Check the file size

Another cause of the “HTTP 400 Error Bad Request” is the size of files you are uploading on a website – like video, images, audio files, etc. If the uploaded file exceeds the maximum upload file size on the origin server, it will respond with “HTTP 400 Error Bad Request”.

You can test by uploading a smaller file to determine if the file size of your original file is too large. If the test with the smaller file is successful, it means that the original file is too big. You may consider compressing the file to reduce its size with an application on your local device or with an online compression tool.

Example:

  • ⛔️ Incorrect Action – Uploading a video file of 150MB to a website where the maximum upload limit is 100MB.
  • Correct Action – Compressing the video file to 80MB and then uploading it to the website.

7. Check your internet connection

If you followed all troubleshooting steps as described above but you still encounter the “HTTP 400 Error Bad Request”, you may also consider the possibility of connectivity issues coming from your network. In order to test, switch your internet connection. For instance, if you use a Wi-Fi/cable network, switch your device to a mobile 3G/4G/5G network. If the error is gone, you can conclude that the error is coming from your network or ISP (Internet Service Provider). In this case, you may consider restarting your Wi-Fi/cable modem or router or contacting your ISP so they can investigate the origin of the connectivity issue.

8. Contact the website administrator or the hosting provider

If none of the above methods are working and other visitors using different networks experience the same error, it is safe to assume that the origin of the error is a misconfiguration of the website. You may consider contacting the website administrators to report the error so they can investigate it. If you are managing the website, contact your hosting provider’s support team to further examine the problem with them.

Monitoring HTTP Error 400 to Protect Your SEO

HTTP 400 errors can negatively impact your site’s user experience and SEO performance. To ensure your site remains optimized, regularly run bulk checks using tools like Website Auditor. This tool identifies all pages with 400 error codes, allowing you to export the list for detailed analysis and management. By promptly addressing these issues, you can maintain a smooth user experience and strong search rankings.

Launch the software to start the scan, set up a new project, and allow the tool to crawl and analyze your site’s pages. After the scan, navigate to the Site Audit module and review the Indexing and Crawlability section for any resources that have 4xx status codes.

What are the most common causes of the “400 Bad Request” error?

As we examined so far, the most common causes of the HTTP Error “400 Bad Request” are related to a local problem from your device or browser and, in rare cases – a misconfiguration on the website’s server. These can be:

  • expired cookies,
  • syntax errors in the URL,
  • outdated cache from your browser,
  • file size limits when uploading a file,
  • unsynchronized DNS cache from your device,
  • a server-related error.

We will examine each type of error in detail and what are its most common causes.

URL String Syntax Error

This is a very common cause of a “400 Bad Request” error, and it is associated with the syntax of the address you are typing in your browser. The error indicates that the requested URL doesn’t have a valid structure or contains invalid characters which the web server is not recognizing as part of a valid URL address.

Below, you can see an example of a URL with a syntax error:

https://www.domain.com/support/kb/404_not_found_error/

In this example, the error is triggered by the double “percentage” sign (%) in the URL structure. Web servers do not permit URLs containing two consecutive special characters, and the part “%%” is causing the web server to respond with a “400 Bad Request” message.

Corrupted Browser Cache & Cookies

In order to improve user experience and loading speeds, most popular browsers store data from previously visited sites in the form of cached files and cookies.

The cached data allows you to reload faster as the browser has already downloaded files from the site locally on your computer and doesn’t require time to download them again from the server. Such files include:

  • Media – video and image files
  • HTML files
  • Data files – JSON, XML
  • JavaScript files
  • CSS files

On the other hand, the saved cookies store information from previous sessions on the site. For example, if you previously logged in on the site, the browser will save the login details and allow you to stay logged in for a longer time, even if you close the browser tab. A website can use many cookies to serve different functions to visitors.

Those browser features are extremely useful, but if your browser has saved corrupt or outdated files or cookies with expired information, the web server may not correctly recognize your next request to visit the site.

Browser extensions and plugins

Occasionally, you may see the error “400 Bad Request” on Chrome, Firefox, Safari, and other browsers due to an installed extension interfering with the connection to the website.

Unsynchronized DNS Cache

The local DNS cache from your device or network also improves user experience and speed. Previous DNS lookups are cached, so the next time you type in a website URL, the website domain’s DNS settings are directly loaded from the local DNS cache, saving loading time. However, if your local cached DNS settings are out-of-sync or outdated and the domain’s DNS settings have been changed, your browser may return the response code “400 Bad Request”.

Incorrect file size

Another common cause of the “400 Bad Request” error is the server limits for the file sizes of uploaded files. It is a common practice for web servers to have a specified maximum size of uploaded files on a website they host. The most common case is – when you upload a file to a website, the upload takes quite a long time, and finally, you receive the error “HTTP Error 400 Bad Request”. Simply, the file is too large and hits the file size limit on the website’s server, so the server responds with the error code.

Website misconfigurations

This is not a common cause and is highly unlikely, but sometimes, the problem may stem from an unidentified website misconfiguration.

Conclusion

Dealing with an “HTTP Error 400 Bad Request” can be challenging, but understanding its causes and knowing how to fix it can save you time and frustration. By following the methods we outlined in this guide, you can resolve most 400 response code issues. If you continue to experience problems, consider reaching out to the website administrator or your hosting provider for further assistance.

FAQs on 400 Bad Request

Can a 400 Bad Request Error be caused by the server?

A 400 Bad Request status code is considered a client error, but it can be related to certain server limits. While rare, server misconfigurations can sometimes cause an invalid response error.

How do I fix HTTP Error 400 size the request headers is too long?

When you stumble on a “400 Bad Request” error indicating that the request header is too long, it generally means the server rejects the request due to excessively large request header fields. You can resolve this “HTTP Error 400” by clearing your browser’s cache and cookies, as these can accumulate oversized headers.

Additionally, check for browser extensions that might add unnecessary data to your requests. Disabling or removing such extensions can help resolve the error. If the problem persists, try accessing the site from a different browser or device to rule out local issues.

What is the difference in HTTP status code 400 vs 404?

A “400 Bad Request” error means the server cannot process the request due to client-side issues. A “404 Not Found” error, on the other hand, indicates that the server cannot find the requested resource. In short, a 400 error is about a bad request, while a 404 error is about a missing resource.

A “404 Not Found” error can be cached based on HTTP headers like “Cache-Control” and “Expires”. While a “400 Bad Request” error should not be cached because it could lead to valid subsequent requests being incorrectly rejected.

What is the difference between 400 errors and 500 errors?

The main difference between HTTP response status codes 400 and 500 lies in their cause. A “400 Bad Request” error is a client-side issue, meaning the problem originates from the user’s request, like a malformed URL or invalid request parameters. Other 4XX client errors are errors 401, 404, and 429.

On the other hand, 500 errors are server-side issues. Such are errors 500, 502, 504, for example. They indicate that something has gone wrong on the server itself, like a server crash or a misconfiguration. In summary, 400 errors are due to client mistakes, while 5XX errors are due to server problems.

Share This Article