Kembali ke Blog
📝
#url encoder #url decoder #developer tools #tutorial #web development

Cara Encode Decode URL Online - Percent Encoding

TulisSurat
28 Maret 2026
4 min baca
0tayangan

Apa Itu URL Encoding?

URL Encoding (disebut juga percent-encoding) adalah proses mengubah special characters menjadi format yang aman untuk dikirim melalui URL. Special characters diganti dengan % diikuti kode hexadecimal ASCII.

Kenapa URL Perlu Di-Encoding?

URL hanya boleh mengandung karakter ASCII tertentu:

  • ✅ Huruf: A-Z, a-z
  • ✅ Angka: 0-9
  • ✅ Special: -, _, ., ~

Karakter lain harus di-encode:

  • ❌ Spasi → %20
  • & (query separator) → %26
  • = (key-value separator) → %3D
  • ? (query start) → %3F
  • # (fragment) → %23

Contoh URL Encoding

URL dengan Spasi

Original:  https://example.com/search?q=hello world
Encoded:   https://example.com/search?q=hello%20world

URL dengan Multiple Parameters

Original:  https://example.com/search?q=hello world&lang=id&category=books
Encoded:   https://example.com/search?q=hello%20world&lang=id&category=books

URL dengan Karakter Special

Original:  https://example.com/page?name=John&Doe&type=A+B
Encoded:   https://example.com/page?name=John%26Doe&type=A%2BB

Common URL Encodings

CharacterEncodedDescription
(space)%20Spasi
&%26Ampersand
=%3DEquals sign
?%3FQuestion mark
#%23Hash/fragment
+%2BPlus sign
%%25Percent sign
/%2FSlash
:%3AColon
@%40At sign

Fitur URL Encoder/Decoder TulisSurat

✅ Encode URL

Convert special characters ke percent-encoding.

✅ Decode URL

Kembalikan percent-encoding ke karakter asli.

✅ Auto-Convert

Convert otomatis saat mengetik (0.5 detik delay).

✅ Swap Input/Output

Tukar input/output untuk reverse operation.

✅ Copy/Download

Salin atau download hasil.

Cara Menggunakan URL Encoder

Langkah 1: Buka Tools

Kunjungi halaman URL Encoder/Decoder di TulisSurat.

Langkah 2: Pilih Mode

  • Encode — untuk convert URL ke percent-encoding
  • Decode — untuk convert encoded URL ke readable format

Langkah 3: Input URL

Paste atau ketik URL di kotak input.

Contoh Encode:

https://example.com/search?q=hello world

Contoh Decode:

https://example.com/search?q=hello%20world

Langkah 4: Auto Convert

Output akan muncul otomatis.

Langkah 5: Copy atau Download

Salin hasil atau download sebagai file.

Kapan Menggunakan URL Encoding?

🌐 Query Parameters

https://example.com/search?q=javascript%20tutorial&sort=relevance
mailto:email@example.com?subject=Hello%20World&body=I%20love%20TulisSurat

📱 Social Media Share

https://facebook.com/sharer.php?u=https%3A%2F%2Fexample.com%2Farticle

🔗 API Endpoints

https://api.example.com/users?filter=name%3D%22John%20Doe%22

📄 Form Data (GET Request)

search?q=url+encoding+tutorial&category=web+development

URL Encoding vs HTML Encoding

Jangan bingung antara URL encoding dan HTML encoding:

ContextEncodingExample
URL%20hello%20world
HTML hello world

JavaScript URL Encoding

Encode

const url = "https://example.com/search?q=hello world";
const encoded = encodeURIComponent(url);
console.log(encoded);
// https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world

Decode

const encoded = "https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world";
const decoded = decodeURIComponent(encoded);
console.log(decoded);
// https://example.com/search?q=hello world

Encode URI Component vs Encode URI

const uri = "https://example.com/search?q=hello world";

encodeURIComponent(uri);
// https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world

encodeURI(uri);
// https://example.com/search?q=hello%20world

Perbedaan:

  • encodeURIComponent() — Encode semua special characters
  • encodeURI() — Tidak encode :, /, ?, #, &, =

URL Encoding untuk WhatsApp

Format URL WhatsApp:

https://wa.me/6281234567890?text=Hello%20saya%20tertarik%20dengan%20produk%20Anda

Manual:

https://wa.me/6281234567890?text=Hello saya tertarik dengan produk Anda

Encoded:

https://wa.me/6281234567890?text=Hello%20saya%20tertarik%20dengan%20produk%20Anda

Search Query:

cara membuat website dengan wordpress

Encoded URL:

https://www.google.com/search?q=cara%20membuat%20website%20dengan%20wordpress

Tips URL Encoding

1. Encode Value, Bukan Key

// ✅ Good
const key = "q";
const value = "hello world";
const url = `/search?${key}=${encodeURIComponent(value)}`;

// ❌ Bad (over-encoding)
const url = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;

2. Gunakan Library untuk Complex URLs

// Manual encoding error-prone
const params = new URLSearchParams({
  q: 'hello world',
  lang: 'id',
  category: 'web development'
});
const url = `/search?${params.toString()}`;

3. Browser Auto-Encode

Browser modern auto-encode URL di address bar, tapi untuk programming perlu manual encode!

Common Errors

❌ Double Encoding

Original:  hello%20world
Encoded:   hello%2520world  // ❌ Wrong!

❌ Decode Then Use

Jangan decode URL sebelum menggunakannya di browser/application.

❌ Encode Already Encoded Parts

// ❌ Bad
const url = "https://example.com/search?q=hello%20world";
encodeURIComponent(url);  // Double encode!

// ✅ Good
const query = "hello world";
const url = `https://example.com/search?q=${encodeURIComponent(query)}`;

Kesimpulan

URL Encoder/Decoder adalah tools essential untuk developer web yang bekerja dengan URLs, query parameters, atau API endpoints. Dengan auto-convert dan swap features, tools ini memudahkan encode dan decode URLs.

Mulai encode decode URL sekarang di URL Encoder/Decoder!


Baca juga:


💡 Tip: Gunakan encodeURIComponent() untuk query values, bukan encodeURI() untuk hasil yang lebih akurat!

Butuh Bantuan Membuat CV?

Gunakan CV Builder kami untuk membuat CV profesional dengan template ATS-friendly!

  • Template ATS-friendly
  • Download langsung jadi PDF
  • Gratis, tanpa perlu login
Buat CV Sekarang →

Bagikan artikel ini:

Butuh Bantuan?

Tim kami siap membantu Anda. Silakan hubungi kami melalui WhatsApp untuk pertanyaan, masukan, atau bantuan teknis terkait penggunaan TulisSurat.

Respon Cepat Gratis Konsultasi Senin - Jumat, 09.00 - 17.00
Hubungi via WhatsApp

Contoh pesan: "Halo, saya kesulitan saat download PDF. Bisa dibantu?"