Skip to content

DoctorLai/base64-converter

Repository files navigation

πŸ”€ Base64 Converter

CI Test Coverage Ask DeepWiki

License: MIT Node.js Code style: Prettier PRs Welcome JavaScript

Top language Repo size Commit activity Last commit

Stars Forks Watchers Open issues Open PRs

A simple, privacy-friendly web tool to encode or decode Base64 strings and files, right in your browser. Built with React, it offers a clean two-textarea interface β€” paste content to convert instantly, or upload files for encoding. The interface is available in 26 languages, with light/dark themes, live counts, and one-click copy. Your data never leaves your device.

This tool also supports decoding of .b64 files into their original binary form.

πŸš€ Features

  • Base64 Encode/Decode: Convert plain text to Base64 and vice versa.
  • File Upload: Upload files to encode or .b64 files to decode.
  • Download Results: Download the converted content as .b64, .bin, or .txt.
  • Copy to Clipboard: Copy the input or output with a single click.
  • Live Counts: See character and UTF-8 byte counts as you type.
  • 26 Languages: Switch the interface language on the fly (with right-to-left support).
  • Dark Mode: Toggle between light and dark themes.
  • Tab Support: Proper indentation when using the "Tab" key in text areas.
  • Simple and Intuitive UI: Clean interface that's beginner-friendly.
  • Easy Deployment: Use npm run build and npm run deploy for production.

🌐 Live Demo

Try it out on GitHub Pages: Base64 Converter

image

Please note: this is the open source version of this online tool: Base64 Encoder/Decoder (Javascript) for Text/Binary Files

πŸ›  Installation

To run the tool locally:

  1. Clone the repository:
git clone https://github.com/doctorlai/base64-converter.git
cd base64-converter
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev
  1. Run tests:
## or: npm test
npm run test
  1. Test coverage (enforces the 80% thresholds):
npm run coverage
  1. Lint and format:
## check formatting (Prettier) and lint (ESLint)
npm run format
npm run lint

## auto-fix formatting and lint issues
npm run format:fix
npm run lint:fix
  1. Run everything at once (format, lint, coverage, build):
npm run check
  1. Open http://localhost:5173/base64-converter/ in your browser.

πŸ“¦ Available Scripts

Script Description
npm run dev Start the Vite development server.
npm run build Build the production bundle.
npm run preview Preview the production build locally.
npm run test Run the test suite once.
npm run coverage Run tests and enforce the 80% coverage thresholds.
npm run lint Lint the source with ESLint.
npm run lint:fix Lint and auto-fix where possible.
npm run format Check formatting with Prettier.
npm run format:fix Auto-format the source with Prettier.
npm run check Run format + lint + coverage + build (everything).
npm run deploy Build and deploy to GitHub Pages.

✨ Usage

πŸ“„ Text Encoding/Decoding

  1. Enter plain text in the input box.
  2. Click β†’ Encode to encode the string to Base64.
  3. Enter a Base64-encoded string in the input box.
  4. Click ← Decode to decode.

πŸ“ File Encoding/Decoding

  • To encode a file:

    • Select a file using the "Load File" button.
    • If the file is binary, it will be encoded automatically.
    • Click Save File to save the result as .b64.
  • To decode a file:

    • Select a .b64 file using the "Load File" button.
    • On success, the output will show the decoded binary (which seems random output).
    • Click Save File to save the decoded content (in binary).

Use the 🌞/πŸŒ™ toggle on top to switch between Light and Dark mode.

🀝 Contributing

We welcome contributions! Please read the Contributing Guide and our Code of Conduct before you start.

  1. Fork the repo.
  2. Create your feature branch:
git checkout -b feature-name
  1. Commit your changes:
git commit -am 'Add cool feature'
  1. Push to GitHub:
git push origin feature-name
  1. Open a pull request πŸš€

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file.

πŸ“š Documentation

πŸ™ Acknowledgments

  • Made with ❀️ by @justyy
  • Initial Boilerplate code contributed by ChatGPT-4o and o4-mini.
  • Like this project? Consider buying me a coffee β˜•

Releases

No releases published

Packages

 
 
 

Contributors