Skip to main content

String Encoder / Decoder

Encode and decode strings between CharCode, Hex, Unicode, Base64, HTML entities, and decimal formats.

Features

Everything you need to encode and decode strings across multiple formats.

Multi-Format Support

Switch between six encoding formats including CharCode, Hex, Unicode, Base64, HTML entities, and decimal.

Instant Conversion

Enable auto-mode for real-time encoding and decoding as you type, with smart debouncing for smooth performance.

Base64 Encoding

Full UTF-8 Base64 encoding and decoding support, perfect for data URIs, API payloads, and email attachments.

CharCode Analysis

Convert text to String.fromCharCode representation and back, useful for JavaScript development and debugging.

HTML Entity Encoding

Encode text as numeric HTML entities (&#DD;) for safe embedding in HTML documents and preventing XSS.

Six Encoding Formats

Switch between CharCode, Hex, Unicode, Base64, HTML entities, and decimal in one place.

How It Works

Three simple steps to encode or decode any string.

1

Enter or Paste Text

Type or paste your plain text (to encode) or encoded string (to decode) into the input area.

2

Select a Format

Choose the encoding format: CharCode, Hex, Unicode, Base64, HTML Entities, or Decimal.

3

Click Encode or Decode

Hit the Encode or Decode button to convert your string. Copy the result or swap it back to the input for chaining.

Related Tools

More developer tools to help you debug and analyze web data.

Frequently Asked Questions

Common questions about string encoding and decoding.

What is string encoding and why is it used?

String encoding converts text into a different representation using a specific format. It is used for many purposes: Base64 encoding lets you embed binary data in text-based formats like JSON or HTML; HTML entity encoding prevents cross-site scripting (XSS) by escaping special characters; and hex/unicode encoding is used in programming languages to represent non-printable or special characters.

When should I use each encoding format?

Use Base64 for embedding data in URLs, emails, or JSON. Use HTML Entities when inserting user content into HTML to prevent XSS. Use Hex or Unicode escapes when working with JavaScript strings that contain special characters. Use CharCode for JavaScript code generation. Use Decimal when you need raw numeric character codes for debugging or protocols.

Can string encoding be used for security or obfuscation?

Encoding is NOT encryption and should never be relied upon for security. Base64, hex, and other encodings are trivially reversible by anyone. They are useful for data transport and formatting, but if you need to protect sensitive data, use proper encryption algorithms instead.

Does this tool support Unicode and special characters?

Yes. The Base64 encoder uses a UTF-8 safe method (encodeURIComponent + btoa) that correctly handles multi-byte Unicode characters. The Unicode format produces \uHHHH escape sequences. For characters outside the Basic Multilingual Plane (above U+FFFF), the CharCode and Unicode formats will use the JavaScript charCodeAt value.