Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Base64 Encoder / DecoderNew to Visual Studio Code? Get it now.
Base64 Encoder / Decoder

Base64 Encoder / Decoder

Houssam OUATMANI

|
9 installs
| (0) | Free
Easily encode and decode strings to/from Base64 (with full UTF-8 support) directly from the VS Code context menu.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Base64 Encoder / Decoder Icon

Base64 Encoder / Decoder

Visual Studio Code Extension to instantly encode and decode text to/from Base64 with full UTF-8 support, programming language quote preservation, and native multi-language localization.

License MIT VS Code Version Tests


🚀 Features

  • Dedicated "Base64 >" Context Submenu: Both commands are neatly organized inside a dedicated right-click submenu, visible only when text is selected (editorHasSelection).
  • Smart Quote Preservation: If selected text in code (JavaScript, TypeScript, PHP, Python, Ruby, etc.) is enclosed in quotes ("...", '...', or `...`), the quotes are automatically preserved around the resulting Base64 string (e.g., "Houssam" becomes "SG91c3NhbQ==" without breaking your code syntax).
  • Direct In-Place Replacement: The selected text is replaced immediately with zero dialogs, popups, or manual copy-pasting.
  • Full UTF-8 Support:
    • Accented characters (é, à, ç, ô, etc.)
    • Emojis (🚀, 👋, 🎉, etc.)
    • Non-Latin scripts (Japanese, Arabic, Cyrillic, Chinese, etc.)
    • Newlines (\n, \r\n) and whitespace
  • Strict Validation & Safety:
    • Validates Base64 format and canonical padding prior to decoding.
    • Ensures decoded bytes decode to valid UTF-8 text using strict UTF-8 checking.
    • In case of invalid Base64, the selection remains untouched and an informative error message is displayed.
  • Automatic Multi-Language Support (i18n / l10n): Extension commands, menus, and messages automatically adapt to your VS Code display language (English, French, Spanish, German, Japanese, Simplified Chinese).
  • Multi-Cursor (Multi-Selection) Support: Transform multiple selections simultaneously across your document in a single atomic edit.

📖 Usage

1. Encode to Base64

  1. Select text in the active editor.
  2. Right-click on the selection.
  3. Hover over Base64 and click Encode to Base64 (or Encode en Base64 depending on your language).
  4. The selection is immediately replaced by its Base64 representation.

Example (Plain text):

Hello World

Select -> Right-click -> Base64 -> "Encode to Base64"

SGVsbG8gV29ybGQ=

Example (Programming code with quotes):

const user = "Houssam";

Select "Houssam" -> Right-click -> Base64 -> "Encode to Base64"

const user = "SG91c3NhbQ==";

2. Decode from Base64

  1. Select a Base64-encoded string in the editor.
  2. Right-click on the selection.
  3. Hover over Base64 and click Decode from Base64 (or Decode depuis Base64).
  4. The selection is replaced by the decoded UTF-8 text.

Example:

Qm9uam91ciDDqXTDqSDwn5GL

Select -> Right-click -> Base64 -> "Decode from Base64"

Bonjour été 👋

⌨️ VS Code Commands

Command ID Description
Encode to Base64 base64.encode Encodes the selected text into Base64
Decode from Base64 base64.decode Decodes the selected Base64 string into plain text

Commands are also accessible anytime via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).


🛠️ Development & Testing

Prerequisites

  • Node.js (version 18 or higher)
  • Visual Studio Code

Install Dependencies

npm install

Compile

npm run compile

Watch Mode

npm run watch

Run Automated Tests

npm test

Test Extension Locally

  1. Open this repository folder in VS Code.
  2. Press F5 (or go to the Run and Debug tab and select Run Extension).
  3. A new VS Code window ("Extension Development Host") opens with the extension activated.
  4. Open or create a file, select any text, and test the right-click menu!

Package Extension (.vsix)

npx @vscode/vsce package

📂 Project Structure

base64-vscode-extension/
├── .vscode/
│   ├── launch.json       # VS Code debug launcher (F5)
│   └── tasks.json        # Build tasks (compile / watch)
├── l10n/                 # Code localization bundles (en, fr, es, de, ja, zh-cn)
├── src/
│   ├── base64.ts         # Pure Base64 logic (encode, decode, isValidBase64, quote parser)
│   ├── extension.ts      # VS Code extension entry point & selection editing
│   └── test/
│       └── base64.test.ts# 34 comprehensive automated unit tests
├── icon.png              # Official 256x256 extension icon
├── CHANGELOG.md          # Version history and release notes
├── LICENSE               # MIT License
├── package.json          # Extension manifest, commands & menus
├── package.nls.*.json    # Manifest localization files
├── tsconfig.json         # TypeScript configuration
├── .vscodeignore         # VSIX package file filter
└── README.md             # Project documentation

📄 License

This project is licensed under the MIT License - © 2026 Houssam OUATMANI.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft