Convert HEIF to TXT

Converting HEIF to TXT runs character recognition over the picture and hands back the words as plain text, with no layout and no guarantee — it is a reading of the image, not a transcript. It takes two steps, because the recogniser has no HEIF decoder: convert the HEIF to PNG here, then read that. Nothing is uploaded at either step.

  • Where it runs In your browser. The file is never uploaded.
  • Rebuilt TXT works differently from a HEIF, so this is not the gradual degradation a lossy codec applies. What TXT can express is reproduced faithfully; what it has no equivalent for does not survive at all.
  • File size limit Up to 100 MB per file, free, without an account.
  • Worth knowing The text is read by pattern recognition, so it is a best guess and not a transcript. Clean, straight, well-lit type at a decent resolution comes out close to perfect; a photograph taken at an angle, a faint fax, an unusual typeface or handwriting will produce mistakes. Always read the result against the original before relying on it. The language setting matters — text read with the wrong one comes back as confident nonsense rather than as an error.

Up to 100 files at once. Mixed formats are fine.

A folder of .heif files and an operating system with no answer

The situation this page is written for is a desktop one. The pictures are already on the computer — copied off a phone, exported from a gallery, sent by a colleague, pulled from a backup — and they are documents rather than scenery: invoices, meter readings, handwritten notes, a page of a contract, forty pages of a manual somebody photographed rather than scanned.

On a phone, the operating system frequently offers to select text in a picture and that is faster than any website. On a desktop, with files in this format, there is generally nothing at all: the system may not even render a thumbnail. Recognition in a browser tab is one of the few routes that does not start with installing something.

The recogniser needs a PNG, so make one before you start

The recognition engine reads the file it is given without anything decoding it first. That is deliberate — pushing a picture through a canvas on the way in would flatten transparency to black, and on a scan of white paper that is the difference between readable and unreadable — but it means the only image readers in play are the six compiled into the engine: BMP, JPEG, PNG, PBM, WebP and non-animated GIF. HEIF is not one of them, and no HEIF reader exists anywhere in the recognition core this site serves.

So the job is two conversions rather than one. Convert the HEIF to PNG on this site, then read the text out of the PNG. The decoder that handles the first step is a separate piece of software from the recogniser and it does read HEIF, which is why HEIF to PNG and HEIF to JPG work on their own pages. PNG is the one to choose for the file in between: the photograph has already been compressed once on the device that took it, and a second lossy pass lands on precisely the thin strokes the recogniser is trying to match.

This is the only conversion here that can be wrong

Every other pair on this site either works or fails loudly. A picture becomes another picture, and if the encoder cannot manage it you get an error. Recognition is different in kind: it returns text that looks exactly like text whether or not it says what the page said.

So the output is a reading, not a transcript, and it has to be checked against the original. That is not a disclaimer to skip — it is the single most important operational fact about this pair, and it decides how you should use the result.

Set the language before you convert, not after

Four models are available: English, German, French and Spanish. Each is a trained model for that language's letterforms and vocabulary, and the recogniser works strictly within the one you choose.

Choosing wrongly does not produce an error, which is what makes it worth a section of its own. It produces the best match available inside a set that does not contain the correct answer, so the text is fluent, plausibly shaped and wrong. If a result looks strange in a way you cannot account for, this is the first thing to check and it is usually the cause.

Why the first page takes so long and the rest do not

Recognition is the slowest thing on this site by a wide margin, and most of the wait on the first file is not reading — it is downloading and compiling several megabytes of WebAssembly and then a language model.

That cost is paid once per language and kept for the rest of the session, and the model is cached in your browser afterwards so a document tomorrow does not download it again. The practical consequence is counter-intuitive: dropping a folder of twenty pages is far more efficient per page than converting one, so batch the work rather than doing it one file at a time.

What the picture has to look like to be read well

Resolution is rarely the problem with a phone photograph — twelve megapixels gives plenty of pixels per character even when the page fills part of the frame. Geometry and light are the problems.

Photograph the page flat rather than curled, straight down rather than from a chair, and with the light coming from the side so your own shadow is not lying across the text. Those three things change the result more than any setting on this page, and a page shot at an angle produces errors that no amount of resolution compensates for.

You get characters, and you lose the shape of the page

The output is plain text: the words, in reading order, with line breaks. There are no columns, no table cells, no headings and no positions on the page, because a text file has nowhere to put them.

A letter or a receipt survives this well. A two-column page interleaves, since the recogniser reads across anything that looks like a line. A table of figures collapses into a run of numbers with no columns, and a form ends up with labels and values adjacent in ways that are hard to untangle. For those, photographing one section at a time gives something you can actually use.

Nothing is cleaned up after the recognition

Blank lines between paragraphs are left as they are, and lines that look like one wrapped sentence are not joined. That is deliberate rather than unfinished: both of those tidyings are guesses about layout, and a poem, an address block and a table all lose meaning when their line breaks are rearranged.

So the file you download is what was read, and any reflowing is a decision for you to make in an editor where you can see both. That is the right order — a converter that quietly reformats a document is much harder to trust than one that hands over exactly what it found.

Read the numbers twice, and the letters once

Prose is forgiving. A misread character in a sentence is usually obvious, and a reader repairs it without noticing. Numbers have no such redundancy: a wrong digit in an amount, an account reference, a meter reading or a date looks exactly like a right one and there is nothing in the sentence to contradict it.

Since the documents people photograph are overwhelmingly the numeric kind — invoices, receipts, statements, readings, reference numbers on letters — the useful habit is to treat the text as a draft for the words and to check every figure against the picture before it goes anywhere.

The documents stay on your machine, and so do the models

The picture is never uploaded. Neither, and this took deliberate work, is anything else: the recognition library fetches its worker script, its WebAssembly core and its language model from a third-party CDN unless every one of those paths is overridden, and all three are served from this site instead.

The distinction matters more than it first appears. The picture would never have left either way, but somebody reading a payslip should not have the fact of it announced to a content network along with their address and the page they are on. A test fails the build if one of those third-party URLs ever reappears.

Keep the picture as well as the text

The text file is a derivative and a fallible one, so the original HEIF is still the record. It is also irreplaceable here: this site can read the format and cannot write it, because the decoder is licensed in a way a static site can honour and no encoder is.

If the document matters, keep both, and consider converting the picture to PDF as well so there is a readable page beside the searchable words. That combination — an image you can show somebody and text you can search — is what most people are actually after when they start this job.

Handwriting is where recognition stops

The models here are trained on printed type, and printed type is what they read well: clean, straight, reasonably sized characters in a common typeface come back close to perfect. Unusual display faces, very small print and heavy italics all cost accuracy, and a faint fax or a fifth-generation photocopy costs a great deal of it.

Handwriting is not a matter of degree. Cursive notes, a signature, a scrawled amount on a receipt or a form filled in by hand will produce output that looks like words and corresponds to nothing. If the valuable part of your picture is handwritten, the honest answer is to type it out yourself and to use the conversion for the printed parts around it — the form, the letterhead, the terms on the back of the page.

The order to do things in with a folder of files

When the folder holds a mixture — some pictures of documents, some of scenery, some already in other formats — sort before converting rather than after. Recognition is the slowest operation on this site, and running it over forty photographs to find the twelve that contain text is a poor use of an afternoon.

The other decision worth making up front is the language, because the setting applies to everything you drop and the initialised recogniser is kept for the rest of the session. A folder that is all German is one setup and forty fast reads. A folder holding two languages wants two passes with the setting changed in between, which costs one extra initialisation and saves you a file full of confident nonsense.

How to read the text out of HEIF pictures

  1. Convert the HEIF pictures to PNG first — the recogniser cannot open a HEIF.
  2. Drop those PNGs here, or click to choose a folder of them.
  3. Choose the language the text is written in before converting.
  4. Read the result against the original, checking every number.

HEIF against TXT: a compressed picture read as characters

HEIF compared with TXT
HEIFTXT
Full nameHigh Efficiency Image File FormatPlain Text
File extension.heif.txt, .text, .log
Media typeimage/heiftext/plain
CompressionLossy — file size is bought with quality
First published20151963
Published byMPEG
SpecificationISO/IEC 23008-12Unicode
LicensingPublished, not standardisedOpen standard
Standing todayCurrentCurrent
Bit depth10
Colour it can describeYCbCr, wide gamut
Opens in a browserSome browsersEvery browser
Considered insteadJPG, AVIFMD, RTF

What the target format adds

TXT is a working format and HEIF is a finished one. What comes back is editable text and objects rather than a picture of a page, which is usually the reason for the conversion and also where its limits are.

Opening the result

TXT opens in every current browser. HEIF has narrower browser support than that. If the file is going onto a web page or into a form, that is usually the whole reason for the conversion.

File size and quality

The result is larger than the original and no better. HEIF has already discarded detail, and TXT stores what is left without discarding more — it prevents further loss rather than undoing the first one.

What each format is for

The two are aimed at different work: HEIF at phones and photography, TXT at moving data between programs and archiving. That is worth weighing before converting, because the reason one exists is usually the reason the other is awkward.

HEIF is MPEG's format, published in 2015. It records 10 bits per channel.

TXT dates from 1963, specified as Unicode. Notepad, TextEdit and Visual Studio Code all read it.

TXT was published in 1963 and HEIF in 2015. The older one is generally the safer file to hand to somebody; the newer one usually does the job in fewer bytes.

HEIF to TXT: languages, accuracy and layout

Are my HEIF files uploaded anywhere?

No. This conversion runs entirely inside your browser, so the file never leaves your device. You can confirm it yourself: open the network tab of your browser's developer tools and convert something. You will see the page load, plus the analytics and advertising the site is paid for with — and nothing carrying your file. The engine behind this particular pair is libheif, the reference decoder for Apple's HEIC; your browser fetches it once and caches it.

Which languages can it read?

English, German, French and Spanish. Each has its own trained model, self-hosted here rather than fetched from a CDN, and the model is cached in your browser after the first run so a second document does not download it again.

What happens if I pick the wrong language?

You get confident nonsense rather than an error. The recogniser matches shapes within one language's letterforms and vocabulary, so given the wrong set it returns the closest available answer from a vocabulary that does not contain the right one.

Why is it so slow compared to the other conversions?

Recognition is by far the heaviest thing this site does. Several megabytes of WebAssembly and a language model have to be compiled first, and that cost is paid once per language rather than once per file — so a batch of ten pages is much faster per page than one page alone.

Is the layout preserved?

No. You get characters and line breaks and nothing else: no columns, no table cells, no positions. A letter comes back in a sensible order; a two-column page interleaves, because the recogniser reads across anything that looks like a line.

Why will a HEIF not read directly?

The recogniser is handed the file as it is, and the decoders inside it cover BMP, JPEG, PNG, PBM, WebP and GIF only. Convert the HEIF to PNG here first and run the recognition on that. It is one extra step, and it leaves you with a readable copy of the page alongside the text.

Do my documents get uploaded?

No. The recogniser, its WebAssembly core and its language models are all served from this site and run inside your browser, and the picture itself never goes anywhere. That was a deliberate piece of work: the library fetches those three things from a third-party CDN unless every path is overridden.

More about these formats