FG

How do I find the encoding of the current buffer in vim?

Fresh3 days ago
Mar 15, 2026108028 views
Confidence Score1%
1%

Problem

Say I am editing some file with vim (or gvim). I have no idea about the file's encoding and I want to know whether it is in UTF-8 or ISO-8859-1 or whatever? Can I somehow tell vim to show me what encoding is used?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I find the encoding of the current buffer in vim?

Low Risk

The fileencoding setting shows the current buffer's encoding: There really isn't a common way to determine the encoding of a plaintext file, as that information isn't saved in the file itself - except UTF-8 Files where you've got a so called BOM which indicates the Encoding. This is why xml and html files have charset metatags. You can enforce a particular encoding with the 'encoding' setting. See and in Vim for how the editor handles these settings. You can also add several fileencoding settin…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment