URL Decoder Tool - Percent Encoding

Share:

This online URL decoder tool will help you to decode the already percent-encoded URL. URL decoder programming examples in .Net, Java and JavaScript.

Enter or paste your percent-encoded URL in the first text box and click Decode URL button.

The URL will be decoded and appears in the second box below.

*


About URL Decoding

URL Encoder

URL decoding is converting the already percent-encoded URL to it's normal form. Read more about URL encoding or percent-encoding here

This URL decoder tools will help you to decode your percent-encoded URL to normal format. For example, it converts the percent-encoded URL "http%3a%2f%2fwww.mytecbits.com%2ftools%2furl%2furlencode" to "http://www.mytecbits.com/tools/url/urlencoder".

Programming URL Encoding with .Net

.Net provides two options to decode a percent encoded string and urls. You can use either HttpServerUtility.UrlDecode method or the HttpUtil.UrlDecode method in the System.Web namespace. Both these UrlDecode methods gives the same result.

Example URL Decoding with C# .Net

using System.Web.Mvc;
namespace SampleCodeSolution.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Contact()
        {
            string strQueryStringUrl = "http%3a%2f%2fwww.mytecbits.com%2ftools%2furl%2furlencoder";
            string sUrl;
            sUrl = Server.UrlDecode(strQueryStringUrl);
            return View();
        }
    }
}

The decoded value in sUrl will be http://www.mytecbits.com/tools/url/urlencoder

Programming URL Decoding with Java

Java provides URLDecoder class to decode and encoded url query string. The URLDecoder class has the method decode which takes in the percent encoded string and returns the decoded url.

Example URL Encoding with Java

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

public class MTBSampleURLDecode {
  public static void main(String args[]) {
        try {
	        String urlQueryString = "http%3a%2f%2fwww.mytecbits.com%2ftools%2furl%2furlencoder";
	        String decodedQueryString = URLDecoder.decode(urlQueryString, "UTF-8");
	        System.out.println("Decoded URL Query String: " + decodedQueryString);
	    } 
        catch (UnsupportedEncodingException e) {
		    System.err.println(e);
	    }
    }
}

Programming URL Decoding with JavaScript

JavaScript provides two functions decodeURI() and encodeURIComponent() to decode the percent encoded url.

decodeURI() function

The decodeURI() function decodes the percent codes in an URI which is encoded by the encodeURI() function.

Example URL Decoding with JavaScript's decodeURI()

<script>
    var urlToDecode = "http://www.mytecbits.com/tools/url/urlencoder?Encode%20this%20'%20text";
    var decodedUrl = decodeURI(urlToDecode);
    alert(decodedUrl);
</script>

The result of above decoding will be http://www.mytecbits.com/tools/url/urlencoder?Encode this ' text

decodeURIComponent() function.

The decodeURIComponent() function decodes all the percent codes encoded by encodeURIComponent().

Example URL Decoding with JavaScript's encodeURIComponent()

<script>
    var urlToDecode = "http%3A%2F%2Fwww.mytecbits.com%2Ftools%2Furl%2Furlencoder%3FEncode%20this%20'%20text";
    var decodedUrl = decodeURIComponent(urlToDecode);
    alert(decodedUrl);
</script>

The result of above encoding will be http://www.mytecbits.com/tools/url/urlencoder?Encode this ' text

Reference


Page Last Modified On: Jul 23, 2021


Disclaimer: We took every effort to provide higher level of accuracy in the calculators, converters and tools we have added to www.MyTecBits.com Tools section. But, we cannot give any guarantee or can be held responsible for any errors, defects, faults or mistakes in any of the calculators, converters or tools. Please see detailed terms of use and liability disclaimer in Terms of Use Page.

Follow Us