I also want to save the font size in my .emacs
file.
-
1see also: http://stackoverflow.com/questions/2091881/emacs-font-sizing-with-ctrl-key-and-mouse-scroll – Michael Paulukonis Mar 25 '11 at 13:41
-
3This is the simplest answer that worked for me http://stackoverflow.com/a/6050987/215094 – Zeynel Dec 18 '13 at 18:24
-
4Novice, use `.emacs.d/init.el` instead which is better (cleaner and better version control) – XY L Apr 08 '16 at 08:35
-
1See also https://emacs.stackexchange.com/a/10439/5165 – imz -- Ivan Zakharyaschev Oct 07 '21 at 19:38
17 Answers
(set-face-attribute 'default nil :height 100)
The value is in 1/10pt, so 100 will give you 10pt, etc.
-
2I'm trying to do this, but in Emacs 23.1.1 the auto-complete will only show the options `set-face-background set-face-font set-face-inverse-video-p set-face-underline set-face-background-pixmap set-face-foreground set-face-stipple set-face-underline-p`. – The Student Jan 24 '13 at 12:38
-
9@TomBrito Which autocomplete? In my Emacs, `set-face-attribute` is indeed missing from `M-x` (`execute-extended-command`), but it is present in `M-:` (`eval-expression`) and `C-h f` (`describe-function`). `M-:` is probably what you want, if you don't want to put this in your `.emacs` file. – Rory O'Kane May 09 '13 at 14:20
-
1@RoryO'Kane Why are some commands not available via `M-x`? Noob question, I'm sure, but I'm not familiar with how emacs "works" at a low-level – DavidS Mar 06 '15 at 20:53
-
6@DavidS Good question. I wrote up an answer at “[Why are some Emacs functions not available via `M-x`?](http://stackoverflow.com/a/29199808/578288)”. Researching the answer turned out to be educational. – Rory O'Kane Mar 22 '15 at 21:05
-
2This solution doesn't work though when you have customized some faces, e.g. to have a distinct font, slant, etc. They would be left with the old size, and you gotta set them individually. – Hi-Angel Jan 28 '19 at 08:22
-
Confirmed does not work in GNU Emacs 25.2.2 for my init.el file at least. I love having a beautiful night of coding on emacs, then spending 1+ hr trying to figure out how to decrease the font size. – Matthaeus Gaius Caesar Apr 04 '22 at 05:53
From Emacswiki, GNU Emacs 23 has a built-in key combination:
C-xC-+ and C-xC-- to increase or decrease the buffer text size

- 1,376
- 1
- 17
- 32

- 5,343
- 3
- 20
- 17
-
34
-
75This is local to that particular buffer. So when you switch to other files you're editing, they will not see the effect of this change. Also when you close and reopen the buffer (or even restart Emacs), they'll be at the old default size. This may be what you want; I'm just stating this for completeness. – ShreevatsaR May 22 '12 at 04:43
-
11
-
works in spacemacs UI (in macos), to set in init.el - https://stackoverflow.com/a/296316/432903 – prayagupa Oct 01 '18 at 05:26
-
In elisp, these keys run the `text-scale-adjust`, `text-scale-increase`, and `text-scale-mode` functions in `face-remap.el` – Dave X Jul 06 '21 at 01:33
-
If you want `C-x C-+` to increase font size in *all* buffers, check [this](https://stackoverflow.com/a/60641769/9450152) post – kotchwane Feb 12 '22 at 12:43
Press Shift and the first mouse button. You can change the font size in the following way: This website has more detail.

- 30,962
- 25
- 85
- 135

- 57,289
- 29
- 176
- 237
-
1@AndrewLarned To make the change permanent, you'd make the change in your .emacs file. (See Chris Conway's answer for an example of what he has in his .emacs file.) – Ram Narasimhan May 24 '12 at 03:16
-
Is there any way to control how much it increases or decreases the font when doing this? – Mauricio A. Cinelli Nov 13 '13 at 12:35
M-x customize-face RET default will allow you to set the face default
face, on which all other faces base on. There you can set the font-size.
Here is what is in my .emacs. actually, color-theme will set the basics, then my custom face setting will override some stuff. the custom-set-faces is written by emacs's customize-face mechanism:
;; my colour theme is whateveryouwant :)
(require 'color-theme)
(color-theme-initialize)
(color-theme-whateveryouwant)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
'(font-lock-comment-face ((t (:foreground "darkorange4"))))
'(font-lock-function-name-face ((t (:foreground "navy"))))
'(font-lock-keyword-face ((t (:foreground "red4"))))
'(font-lock-type-face ((t (:foreground "black"))))
'(linum ((t (:inherit shadow :background "gray95"))))
'(mode-line ((t (nil nil nil nil :background "grey90" (:line-width -1 :color nil :style released-button) "black" :box nil :width condensed :foundry "unknown" :family "DejaVu Sans Mono")))))

- 25,949
- 8
- 77
- 100

- 496,577
- 130
- 894
- 1,212
-
2Many advanced emacs users prefer to not use the customize system, as it's error prone and intermingles all customizations. It's better to break your customization up into individual .el files and load them from init.el, and add your mode customizations as elisp code within each one. See huaiyuan's answer above to see how to set font via elisp. – EdwardG Jun 19 '13 at 02:28
-
3FWIW, the emacs maintainer (presumably an "advanced" user of emacs) uses the customize system: https://github.com/jwiegley/dot-emacs/blob/bb93466aab71b1140da31f3e6e16e8d0615b2c21/settings.el#L1227-L1252 – Ben Mar 13 '18 at 17:02
This is another simple solution. Works in 24 as well
(set-default-font "Monaco 14")
Short cuts:
`C-+` increases font size
`C--` Decreases font size

- 7,119
- 4
- 31
- 40
-
2`set-default-font` is now deprecated. Use either `(set-frame-font "Monaco 14")` or `(set-face-attribute 'default nil :height 130)` – kotchwane Feb 12 '22 at 12:04
-
@kotchwane Thank you for the warning. Do you know what's the relationship between the size in `set-frame-font` and in `:height`? In my Emacs, setting the latter to 93, 94, or 95 has exactly the same effect. – pglpm Aug 02 '22 at 10:55
Open emacs in X11, goto menu Options, select "set default font ...", change the font size. Select "save options" in the same menu. Done.

- 195
- 1
- 2
-
4
-
To keep the setting for the next time, make sure you select _save options_ after setting the font – G Eitan Apr 13 '22 at 08:44
I've got the following in my .emacs
:
(defun fontify-frame (frame)
(set-frame-parameter frame 'font "Monospace-11"))
;; Fontify current frame
(fontify-frame nil)
;; Fontify any future frames
(push 'fontify-frame after-make-frame-functions)
You can subsitute any font of your choosing for "Monospace-11"
. The set of available options is highly system-dependent. Using M-x set-default-font
and looking at the tab-completions will give you some ideas. On my system, with Emacs 23 and anti-aliasing enabled, can choose system fonts by name, e.g., Monospace
, Sans Serif
, etc.

- 55,321
- 43
- 129
- 155
zoom.cfg and global-zoom.cfg provide font size change bindings (from EmacsWiki)
- C-- or C-mousewheel-up: increases font size.
- C-+ or C-mousewheel-down: decreases font size.
- C-0 reverts font size to default.

- 384
- 4
- 9
-
`C-0` is already in good use unfortunately. And the links broke. But great idea! – Michel de Ruiter Sep 13 '21 at 14:49
Here's an option for resizing the font heights interactively, one point at a time:
;; font sizes
(global-set-key (kbd "s-=")
(lambda ()
(interactive)
(let ((old-face-attribute (face-attribute 'default :height)))
(set-face-attribute 'default nil :height (+ old-face-attribute 10)))))
(global-set-key (kbd "s--")
(lambda ()
(interactive)
(let ((old-face-attribute (face-attribute 'default :height)))
(set-face-attribute 'default nil :height (- old-face-attribute 10)))))
This is preferable when you want to resize text in all buffers. I don't like solutions using text-scale-increase
and text-scale-decrease
as line numbers in the gutter can get cut off afterwards.

- 20,530
- 5
- 56
- 88
Firefox and other programs allow you to increase and decrease the font size with C-+ and C--. I set up my .emacs so that I have that same ability by adding these lines of code:
(global-set-key [C-kp-add] 'text-scale-increase)
(global-set-key [C-kp-subtract] 'text-scale-decrease)

- 10,908
- 10
- 52
- 85

- 103
- 1
- 5
Aquamacs:
(set-face-attribute 'default nil :font "Monaco-16" )
From the Emacs Wiki Globally Change the Default Font, it says you can use either of these:
(set-face-attribute 'default nil :font FONT )
(set-frame-font FONT nil t)
Where FONT
is something like "Monaco-16"
, e.g.:
(set-face-attribute 'default nil :font "Monaco-16" )
There was an extra closing parenthesis in the first suggestion on the wiki, which caused an error on startup. I finally noticed the extra closing parenthesis, and I subsequently corrected the suggestion on the wiki. Then both of the suggestions worked for me.

- 46,922
- 14
- 101
- 127
It all depends what you mean by change the font size. This EmacsWiki section provides the best and most complete information. It distinguishes the various cases (text scaling, frame font, buffer/frame, etc.): Changing Font Size.

- 29,895
- 7
- 74
- 104
Here's a snippet that lets you directly specify the global font size using an interactive function:
(defun set-font-size ()
"Set the font size."
(interactive)
(set-face-attribute
'default nil :height
(string-to-number
(read-string "Font size: " (number-to-string (face-attribute 'default :height nil))))))

- 1,883
- 19
- 27
I you're happy with console emacs (emacs -nw), modern vterm implementations (like gnome-terminal) tend to have better font support. Plus if you get used to that, you can then use tmux, and so working with your full environment on remote servers becomes possible, even without X.

- 687
- 7
- 9
I use hydra package to control font increase/decrease contiguously by pressing f2 + + + +
/f2 - - - -
, which means that press f2
once, and then using +
/-
to control only, and restore default font size by f2 0
. Because i have keypad, so I also bind keypad to the font setting.
(defhydra hydra-zoom (global-map "<f2>")
"zoom"
("<kp-add>" text-scale-increase "in")
("+" text-scale-increase "in")
("-" text-scale-decrease "out")
("<kp-subtract>" text-scale-decrease "out")
("0" (text-scale-set 0) "reset")
("<kp-0>" (text-scale-set 0) "reset"))
And modern editor mouse control functionality supported by below key bindings, press control + mouse wheel to increase/decrease font.
(global-set-key (kbd "<C-wheel-up>") 'text-scale-increase)
(global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease)

- 498
- 3
- 15
-
The key bindings for the mouse wheel don't work, I have version `GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)` – Zelphir Kaltstahl Nov 13 '15 at 17:45
-
1Those would be `(global-set-key (kbd "
") 'text-scale-increase) (global-set-key (kbd " – stefano Mar 09 '17 at 22:07") 'text-scale-decrease)` In my version of emacs (25)