📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube
URL Decoder Online
URL Decoder is an online tool for decoding URLs. Note that, our tool assumes that the input is encoded using the UTF-8 encoding scheme. The worldwide web consortium recommends using the UTF-8 encoding scheme when working with URLs.Check out URL Encoder Online tool at URL Encoder Online
URL Decode Example
https%3A%2F%2Fwww.javaguides.net%2Fp%2Furl-decoder-online.htmlEncoded URL output:
https://www.javaguides.net/p/url-decoder-online.html
What is URL Decoding and why is it required?
Decode URL in JavaScript
Let's first encode using the decodeURIComponent() method and then decode it using the encodeURIComponent() function.
var uri = "https://javaguides.net/my test.html?name=ram&age29";
console.log("before encode :: " + uri);
var encode = encodeURIComponent(uri);
console.log("after encode :: " + encode);
var decode = decodeURIComponent(encode);
console.log("after decode :: " + decode);
before encode :: https://javaguides.net/my test.html?name=ram&age29
after encode :: https%3A%2F%2Fjavaguides.net%2Fmy%20test.html%3Fname%3Dram%26age29
after decode :: https://javaguides.net/my test.html?name=ram&age29
Read more about how to encode and decode URL in JavaScript in a blog post at Encode and Decode URL in JavaScript.
URL Decode in Java
package net.javaguides.network;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
public class URLDecoderExample {
public static void main(String[] args) throws UnsupportedEncodingException, MalformedURLException {
// base URL
String baseurl = "https://www.javaguides.net/search?q=";
// String to be encoded
String query = "core+java+tutorial";
System.out.println("URL without encoding :");
URL url = new URL(baseurl + query);
System.out.println(url);
// encode() method
System.out.println("URL after encoding :");
String encodedStr = URLEncoder.encode(query, "UTF-8");
url = new URL(baseurl + encodedStr);
System.out.println(url);
// decode url process
System.out.println("Encoded URL :");
System.out.println(baseurl + encodedStr);
// decode() method
System.out.println("Decoded URL :");
String decode = URLDecoder.decode(encodedStr, "UTF-8");
System.out.println(baseurl + decode);
}
}
URL without encoding :
https://www.javaguides.net/search?q=core+java+tutorial
URL after encoding :
https://www.javaguides.net/search?q=core%2Bjava%2Btutorial
Encoded URL :
https://www.javaguides.net/search?q=core%2Bjava%2Btutorial
Decoded URL :
https://www.javaguides.net/search?q=core+java+tutorial
Check out how to encode and decode URLs in Java at Java URLEncoder and URLDecoder Class Examples
Comments
Post a Comment
Leave Comment