npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

japanese-fullhalf-convert

v1.0.1

Published

Convert Japanese characters between full-width (全角) and half-width (半角) including Katakana, numbers, and punctuation

Readme

japanese-fullhalf-convert

A JavaScript package for converting Japanese characters between full-width (全角) and half-width (半角) formats.

Features

  • Convert full-width Katakana to half-width Katakana (カタカナ ↔ カタカナ)
  • Convert full-width numbers to half-width numbers (123 ↔ 123)
  • Convert full-width punctuation and symbols to half-width
  • Convert full-width spaces to half-width spaces
  • Bidirectional conversion support

Installation

Method 1: npm install (Recommended)

npm install japanese-fullhalf-convert

Method 2: Import from CDN (Browser)

<!-- Using unpkg -->
<script src="https://unpkg.com/japanese-fullhalf-convert@latest/index.js"></script>
<script>
  // Available as global variable: jpFullhalfConvert
  const { toHalfWidth, toFullWidth } = jpFullhalfConvert;
</script>

<!-- Using jsdelivr -->
<script src="https://cdn.jsdelivr.net/npm/japanese-fullhalf-convert@latest/index.js"></script>

Method 3: ES6 Import (with bundler)

import { toHalfWidth, toFullWidth } from 'japanese-fullhalf-convert';

Usage

CommonJS (Node.js)

const { toHalfWidth, toFullWidth } = require('japanese-fullhalf-convert');

// Convert full-width to half-width
const fullWidth = 'カタカナ123';
const halfWidth = toHalfWidth(fullWidth);
console.log(halfWidth); // Output: カタカナ123

// Convert half-width to full-width
const halfWidth2 = 'カタカナ123';
const fullWidth2 = toFullWidth(halfWidth2);
console.log(fullWidth2); // Output: カタカナ123

// Examples with different character types
console.log(toHalfWidth('HELLO')); // Output: HELLO
console.log(toFullWidth('hello')); // Output: hello
console.log(toHalfWidth(' ')); // Full-width space -> half-width space
console.log(toFullWidth(' ')); // Half-width space -> full-width space

ES6 Modules

import { toHalfWidth, toFullWidth } from 'japanese-fullhalf-convert';

const result = toHalfWidth('カタカナ123');
console.log(result); // Output: カタカナ123

Browser (CDN)

<script src="https://unpkg.com/japanese-fullhalf-convert@latest/index.js"></script>
<script>
  // Access via global variable
  const { toHalfWidth, toFullWidth } = jpFullhalfConvert;
  
  // Or use window object
  const result = window.jpFullhalfConvert.toHalfWidth('カタカナ123');
  console.log(result); // Output: カタカナ123
</script>

Direct File Import (Browser)

<!-- Download index.js from npm and include locally -->
<script src="./path/to/index.js"></script>
<script>
  const { toHalfWidth, toFullWidth } = jpFullhalfConvert;
</script>

API

toHalfWidth(str)

Converts full-width Japanese characters to half-width.

Parameters:

  • str (string): Input string with full-width characters

Returns:

  • (string): String with half-width characters

Example:

toHalfWidth('カタカナ123'); // Returns: 'カタカナ123'

toFullWidth(str)

Converts half-width Japanese characters to full-width.

Parameters:

  • str (string): Input string with half-width characters

Returns:

  • (string): String with full-width characters

Example:

toFullWidth('カタカナ123'); // Returns: 'カタカナ123'

Supported Conversions

Katakana

  • Full-width Katakana (ア-ン, ァ-ォ, ャ-ョ, ッ, ー) ↔ Half-width Katakana (ア-ン, ァ-ォ, ャ-ョ, ッ, ー)

Numbers

  • Full-width numbers (0-9) ↔ Half-width numbers (0-9)

Letters

  • Full-width uppercase (A-Z) ↔ Half-width uppercase (A-Z)
  • Full-width lowercase (a-z) ↔ Half-width lowercase (a-z)

Punctuation and Symbols

  • Full-width punctuation and symbols ↔ Half-width equivalents

Spaces

  • Full-width space ( ) ↔ Half-width space ( )

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.