Charset Encoding Converter
テキスト・ファイルの文字コードをUTF-8 / Shift_JIS / EUC-JP / JIS / UTF-16 間で変換します。
How to Use the Charset Encoding Converter
Japanese text has been stored in several incompatible encodings for decades. Legacy systems and older Excel installations write Shift_JIS (CP932), Unix tooling historically used EUC-JP, email used ISO-2022-JP, and modern applications standardize on UTF-8. When a file written in one encoding is read as another, you get mojibake — strings like 譁�蟄怜喧縺� or ã‚ã„ã†. This converter reads bytes in one encoding and writes them out in another so the text becomes readable again.
Two Modes
Text to bytestakes text you type and shows the exact byte sequence it would produce in the target encoding, formatted as a hex dump with offsets and an ASCII column. This is the fastest way to answer questions like "how many bytes will this name take in Shift_JIS?" or "what does a UTF-8 BOM actually look like?".
File conversion loads a text file, detects its encoding automatically, renders a preview so you can confirm the detection was right, and lets you download the re-encoded file. If auto-detection guesses wrong — which happens with very short files or files that are ambiguous between Shift_JIS and EUC-JP — you can override the source encoding manually and the preview updates immediately.
About the BOM
A byte order mark is a short prefix (EF BB BF for UTF-8) that tells a reader which encoding and byte order to expect. Windows Excel needs it to open a UTF-8 CSV without garbling Japanese, but many Unix tools, shell scripts and JSON parsers treat it as a stray character. The BOM checkbox appears only for UTF-8 and UTF-16 because adding one to Shift_JIS or ISO-2022-JP would corrupt the file.
文字コード変換ツールの使い方
「テキスト → バイト列」モードでは、入力した文字が指定の文字コードでどんなバイト列になるかを HEXダンプで確認できます。「ファイル変換」モードでは、テキストファイルを読み込むと文字コードを 自動判定し、内容プレビューを表示したうえで、別の文字コードに変換してダウンロードできます。
プレビューが文字化けする場合は自動判定が外れています。「入力文字コード」を手動で Shift_JIS や EUC-JP に切り替えると、正しく読めるものが見つかります。処理はすべてブラウザ内で 完結し、ファイルの内容が外部に送信されることはありません。
よくある落とし穴と対処 / Common Pitfalls
| 落とし穴 / Pitfall | 問題 / Problem | 対処 / Fix |
|---|---|---|
| 短いファイルの自動判定 Detection on very short files | 数十バイトしかないとShift_JISとEUC-JPの区別がつかず誤判定する Short samples are ambiguous | プレビューを見て、化けていたら入力文字コードを手動指定する Override the source encoding manually |
| BOMなしUTF-8のCSVをExcelで開く Opening BOM-less UTF-8 CSV in Excel | WindowsのExcelがShift_JISとみなして日本語が化ける Excel assumes the ANSI code page | UTF-8を選び「BOMを付ける」をオンにして出力する Export UTF-8 with BOM |
| BOM付きUTF-8をシェル/JSONで使う BOM in shell scripts and JSON | 先頭のBOMが余分な文字として扱われ、shebang無視やJSON.parseエラーになる The BOM breaks shebangs and JSON parsers | 用途がExcel以外ならBOMは付けない Skip the BOM outside Excel workflows |
| 機種依存文字・絵文字の変換 Characters missing from the target set | UTF-8にしかない文字をShift_JISへ変換すると表現できず落ちる・置換される Characters absent from Shift_JIS cannot round-trip | UTF-8→Shift_JISは不可逆。変換後に該当箇所を確認する Treat the conversion as lossy and review |
| 化けたテキストを再変換して直そうとする Re-converting already-mojibake text | 一度誤ったデコードで置換文字(U+FFFD)になった情報は復元できない Replacement characters are unrecoverable | 元のバイト列(元ファイル)から読み直す Start again from the original bytes |
言語別コード例 / Code Examples
JavaScript (ブラウザ)
// Shift_JIS のファイルを読む
const buffer = await file.arrayBuffer();
const text = new TextDecoder("shift-jis").decode(buffer);
// UTF-8 バイト列にする
const bytes = new TextEncoder().encode(text);Python
# Shift_JIS のファイルを UTF-8 に変換して保存
with open("in.csv", encoding="cp932") as src:
body = src.read()
with open("out.csv", "w", encoding="utf-8-sig") as dst: # sig = BOM付き
dst.write(body)コマンドライン
# nkf を使う場合(Shift_JIS → UTF-8)
nkf -w --overwrite target.txt
# iconv を使う場合
iconv -f CP932 -t UTF-8 in.txt > out.txtバイト列の例 / Byte Examples
文字「あ」のバイト列
UTF-8 : E3 81 82 (3バイト)
Shift_JIS : 82 A0 (2バイト)
EUC-JP : A4 A2 (2バイト)
UTF-16 LE : 42 30 (2バイト)
UTF-8 の BOM : EF BB BF
UTF-16 LE の BOM : FF FEWhy browser-only?
Files that need re-encoding are usually customer exports, access logs, or database dumps — exactly the data you should not upload to a random conversion site. This tool reads the file with the FileReader API and converts the bytes in memory: nothing is uploaded, nothing is logged, and it works offline. Watch the DevTools Network tab while converting and you will see zero requests.
文字コード変換にかけるファイルは、顧客データのエクスポートやログ・DBダンプであることが ほとんどです。本ツールはファイルの読み込みも変換もブラウザ内で完結し、外部送信は一切ありません。