What Is a 400 Bad Request Error and How to Fix It

10 Most Common Types of Cyber-Attacks and Tips to Prevent Them
9 Canva alternatives to nail your DIY designs
Show all

What Is a 400 Bad Request Error and How to Fix It

Website Error 400. Bad Request. Vector artwork depicts a funny and humorous scenario with human stick figure for website http request error.

The client-server interaction is happening continuously. You click on a link to access a resource, and the server responds. The server, in order to inform you whether your request has been successfully completed, it displays an HTTP status code. For example, if your request to access a file was successful, you’ll get a 200 OK status code. If you want to route users to a new location, you’ll use a 301 Moved Permanently status code. 

However, sometimes, certain server-side and client-side issues prevent the client from accessing a resource.The server-side errors are known as 5xx status codes. The most common errors in this cluster are the 502 Bad Gateway error, 503 Service Unavailable error, and the 504 Gateway Timeout error. The client errors are known as 4xx status codes. A 4xx status code means that something on the client-side of things is causing the issue. 

In our previous posts, we talked about the 403 Forbidden error, 404 Not Found error, and the 410 Gone error. In this post, we’ll explain the 400 Bad Request error and discuss its causes. And if you want to know how you can fix one, we’ll offer a few useful tips.

What Is a 400 Bad Request?

A 400 Bad Request error means that the request the client made is incorrect or corrupt, and the server can’t understand it. The main thing to understand is that the 400 error is a client-side error. It indicates that the request the client submitted can’t be processed by the server. In rare cases, it can be a problem with the server that’s causing the error.

What Is the Cause of a 400 Error?

There are several causes why a 400 Bad Request error might appear.The majority of them are due to an issue on the client-side of things. The cause of a 400 error can be a wrongly written URL or a URL that contains unrecognizable characters.

If the URL is correct, then another cause of the error might be an invalid or expired cookie. For example, you can be presented with a 400 Bad Request error when you attempt to log into a site as admin but the cookie that’s handling your authentication data is corrupted. There’s also the possibility of the server coming back with a 400 error if you try to upload a file that’s too large. If the server is programmed with a file size limit, then you might encounter a 400 error. In rare cases, the reason why you see a 400 error might be due to specific problems with the server.

How Can a 400 Error Appear?

As with all other HTTP status codes,the 400 Bad Request error can appear on all browsers and all devices. You can see it on Safari on your macOS and Google Chrome on your Windows 10. Here’s how 400 Bad Request looks on Google Chrome:

It’s also not uncommon for a website to customize its 400 error page. We’ve seen sites doing this with their 404 error pages. This is how the error appears on Google:

Apart from custom-made 400 error pages, websites can also use different names for the error, including:

  • 400 Bad Request

  • HTTP 400 Bad Request

  • HTTP Status 400 – Bad Request

  • 400 Bad Request Error

  • HTTP Error 400

  • Bad Request: Error 400

  • HTTP Error 400 – Bad Request

How to Fix a 400 Bad Request?

When a browser returns a 400 status code, it’s always generic. You’re informed that there’s an HTTP 400 Bad request error on the site, but you’re not offered tips for how to fix it. When it comes to fixing the 400 Bad Request error, you’re all alone. Luckily, we’ve put together a few tips for how you can fix the 400 Bad Request error as soon as it appears.

Check the URL

If you see a 400 error on your site, the first thing you want to do is check to see whether you typed the URL correctly. Check whether the domain name and the specific webpage you want to access are written correctly and are separated with forward slashes. If the URL contains any special characters, ensure they’re correctly inserted. If you’re certain that you typed the correct URL but are still seeing an HTTP 400 Bad Request error, then proceed with clearing your browser cache and cookies.

Clear Browser Cache and Cookies

Corrupted website files might cause a 400 error. This involves all types of files that a site needs in order to function properly such as JavaScript, HTML, and CSS.

To fix this issue,you need to clear your browser cache. This can be done by clicking on the three dots icon on the right-hand corner of the screen. Go to
More Tools and access
Clear Browsing Data. From there, check the
Cached images and
files box and click on the
Clear data button to remove the browser cache.

If clearing your browser cache doesn’t fix the error, you should also remove your browser cookies. Corrupt and expired cookies can trigger a 400 Bad Request error. To clear your cookies, go to the three dots icon on the right-hand corner and click on More Tools to open up the Clear browsing data window. Check the Cookies and other site data box and choose All time for the time range option. Doing this will delete all website cookies. However, if clearing your browser cache and cookies doesn’t help, the next thing you can do is to clear your DNS cache.

Flush Your DNS

Corrupted or out-of-date DNS lookup data is another reason why you’re seeing an HTTP 400 Bad Request. To fix it, you need to clear your DNS cache. DNS data is stored on the operating system of your device, and not on the browser. Depending on whether you’re using a Windows OS, macOS, or Linus, read this detailed guide on clearing DNS cache.

Check for File Size

As we’ve mentioned earlier, another cause for a 400 error is file size. If you’re trying to upload a file that’s too large that it exceeds the server file limit, you’ll get a 400 error. To confirm that this is causing the issue, try to upload a file that’s smaller in size. If you succeed, then it means that the original file is too large. To reduce its size, consider using a tool for compressing large files.

Restart Your Computer and Other Equipment

If all of the options above fail, you can also try restarting your computer and other equipment such as routers and modems. Although this happens rarely, a temporary issue with your device or networking equipment may be causing the problem.

Get in Touch with Your Hosting Company

In rare cases, the cause for a 400 Bad Request error is due to issues with the server and not the client. To check if there’s an issue with the server, try loading the site from a different browser and device. If you can’t access the site from a different browser and device, then it’s likely a server-side problem.  Get in touch with your hosting company to inform them of the issue. Let them know what browser and operating system you’re using. They might be able to offer tips for resolving the issue.

Final Word

The 400 Bad Request error is a client-side error that can appear on any operating system and browser. In many cases, the cause for the error is corrupted browser files and cookies, as well as wrongly inserted URL and large file size. Anyone who possesses minimal technical knowledge can easily implement the solutions we outlined above, and hopefully, fix the error.

Only in rare cases, the cause for the issue is a server-side error. When this happens, it’s best to get in touch with the hosting company. If you’re a website owner, knowing all types of HTTP status codes is critical. From 404 Not Found to 503 Service Unavailable, knowing what each error represents is crucial for the health of any online business. To help you, we’ve put together this comprehensive HTTP status code cheat sheet that you use to learn about the different types of status codes and their meaning.

And after you’re done with learning all about the HTTP status codes, make sure you invest in proper website maintenance services. Regular monitoring and maintenance will help keep your website error-free and its owner worry-free.

Leave a Reply

Your email address will not be published.