Home » Core Java » net » URLDecoder » java.net.URLDecoder Example

About Vaibhav Kulkarni

Avatar photo
Vaibahv is PH.D candidate and holds masters degree in computer application. He is active contributor to Apache Software Foundation as well as openJDK.

java.net.URLDecoder Example

URLDecoder is a utility class for HTML form decoding. This class contains static methods for decoding a String from the application/x-www-form-urlencoded MIME format.

Project Environment

This example was implemented using the following tools :

  • Eclipse 4.3 (Kepler)
  • JDK 1.4 or greater

1. Example of URLDecoder

We are going to decode string in this example. Create a java class named URLDecoderExample and paste the following code.


package com.example.javacodegeeks;

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

public class URLDecoderExample {
	public static void main(String args[])throws UnsupportedEncodingException
		System.out.println(URLDecoder.decode("special+chars%3A+%26%25*+", "UTF-8"));

In above example we are decoding string in UTF-8 format.


special chars: &%* 

Download the source code

This was an example of URLDecoder in Java.

You can download the full source code of this example here:URLDecoderExample.zip

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....


Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions


Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments